From patchwork Fri Jul 28 15:54:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_G=C3=B6ttsche?= X-Patchwork-Id: 127739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp556720vqg; Fri, 28 Jul 2023 09:38:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlHFONBGw/F418/eyxQ83Xxek/XDLi/Dd/vz4ivehfmGB94ddAgiJ1G+AF0CX04fwajjVEkn X-Received: by 2002:a05:6a21:a105:b0:133:ebf2:96da with SMTP id aq5-20020a056a21a10500b00133ebf296damr2363418pzc.41.1690562282328; Fri, 28 Jul 2023 09:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690562282; cv=none; d=google.com; s=arc-20160816; b=qQTFiODpZ7B+C7fTXLljjhdmpjLsRS3dNhXI3mCDRjaTGfJ9NxWf4+R38K+MYBzon4 drV1ATRi5JW8rtnvFgb592wcBK0IHsQRZrFe78N8/WMS/X/w2Log5aViH22v/tEsomY5 zbSrX0csNFt49CnECoPl7zwbKVEif8G2i+Si1rAPfbXdjNkuCNMuXZXZGLKIaX31F3rv Zwpc92S8/pxpIukPg/qy9W0yR1vu7f37HVYvvCyUWWlOmRzmSWV6kXy/Ts2Vzms/ndis c7WlgA/C41lSYySRLFvZZ9sj+MB2G7vTKOGpnzPUCkcOByqmks3A4PJDs5KSZ3hzR/ai zAEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EPHbKlNohEyT6fHekCE2tm7ibKK+fjaWchkmGqjYMrs=; fh=QKur2PFwoLuCt27JzfZM4LabS9ldoGoSAJNPH9t/KWI=; b=TDFvfzdcHNG7oFtsWyZ2HIp2RgpTewWTWzHukIEt/tIGOeltPsCmktFTA0V+cqXy7d Ells3VkoVDrOuwufSZ/LoWlYpNuf6K3SNmtGzqrVJX74l23TA9w59ZuNfjrlY6O6LTbK lXwwz0UiWzd4F1EYHVSZ2IMGy0ybZyAQ/S/623AXFqGmFlm4iZfHzfH1/HNesA/vc6RT ZciGZlvt08yWnhekk2bRIHth9uowMYoRk1jqShFYWU8jw3yS2EWqCPPpY3uTbTujMDzh oPkB9lUsdiLHrhTMQ8tIeGgzd1Hfa409krtXAp2N3iy6ZrFX+TtX15TnjZ91kx7iD2b5 t/Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=nRseK7z6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k188-20020a633dc5000000b0053fb85dd81asi3287339pga.325.2023.07.28.09.37.48; Fri, 28 Jul 2023 09:38:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=nRseK7z6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237378AbjG1P4C (ORCPT + 99 others); Fri, 28 Jul 2023 11:56:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236430AbjG1Pzb (ORCPT ); Fri, 28 Jul 2023 11:55:31 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B138421B; Fri, 28 Jul 2023 08:55:21 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-9922d6f003cso328691566b.0; Fri, 28 Jul 2023 08:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1690559720; x=1691164520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EPHbKlNohEyT6fHekCE2tm7ibKK+fjaWchkmGqjYMrs=; b=nRseK7z65pCewXQfBxUb9pU4jiS+a1bz8h14DsuF3KLRf9Kq8QFUEnBH8kLrdtQmSQ 2jWf39AwJjxUQQ6SMKQo8HICYrdEtgMpR8OQdAigEOgsFtSlxYAyjbm6IViTbFiY7siS jtGjVgBc14MwEl9imJxJQtov1PUzh8jT/Dup52LUK9io/dXU+1JkoRVdD+PBhPtD+EwP 4iK8oa4xn6aHMGsbWr4edP8dbLoq+hkCEB/WErSf8laR0GxSgTJamVXnKDe+cPLd0Kh3 ONfZ8vs4DBdTQbIyp+hT5lCHJ2gta2Zs0+prif/VbtH2EWGirCEDBh8VtBCihY88gbFC JzVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690559720; x=1691164520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EPHbKlNohEyT6fHekCE2tm7ibKK+fjaWchkmGqjYMrs=; b=Vo0qCHp+04t2vJ8QfUu9QxwWk32rZ9Wfx0uzVuCT52OflK/mv/hAmZbFW1hW/vcD/d 1sHWpl2po7biyInWV0xebFSYIsHBi6d+nKKvbKC06LtV1gy4xL/GL+8YpMU4ZeBGzVut 3yfU/PoqA5VMqPvJrY9QunJ8bao7C7HLp3YQEOzALDZwagrB9HlCsTX4qh9W68JMV2fu /NrfynJCmA+/0xkwqPYmXZukEKS5mfEe414PIN/G/TMN8SDaOCq1hEF31p8HlqxyNzgu ZlG7ZC7V4Q/iufnHE5xDAgdcFYg14U0IW7VyU3SiHU5oF4XnL+YKAGdbYHlPzPwiv2Hr rNaQ== X-Gm-Message-State: ABy/qLb22miU8LVtdIEf6J7fIRkhvU4R7NY+HSxpC6VYg8mKOStwk8fP b2pFVzJzZS2DDFRv9pfODZ1VODai8i005v9j X-Received: by 2002:a17:906:31db:b0:993:d88e:41ed with SMTP id f27-20020a17090631db00b00993d88e41edmr2757566ejf.3.1690559720100; Fri, 28 Jul 2023 08:55:20 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-077-000-157-016.77.0.pool.telefonica.de. [77.0.157.16]) by smtp.gmail.com with ESMTPSA id f5-20020a1709064dc500b0098669cc16b2sm2198345ejw.83.2023.07.28.08.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jul 2023 08:55:19 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= To: selinux@vger.kernel.org Cc: Paul Moore , Stephen Smalley , Eric Paris , linux-kernel@vger.kernel.org Subject: [PATCH v2 9/9] selinux: avoid implicit conversion in nlmsgtab code Date: Fri, 28 Jul 2023 17:54:59 +0200 Message-Id: <20230728155501.39632-8-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230728155501.39632-1-cgzones@googlemail.com> References: <20230728155501.39632-1-cgzones@googlemail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772683035870537838 X-GMAIL-MSGID: 1772683035870537838 Use an unsigned type as loop iterator. Signed-off-by: Christian Göttsche --- v2: avoid declarations in init-clauses of for loops --- security/selinux/nlmsgtab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 2ee7b4ed43ef..2f8fab949633 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c @@ -153,7 +153,8 @@ static const struct nlmsg_perm nlmsg_audit_perms[] = { static int nlmsg_perm(u16 nlmsg_type, u32 *perm, const struct nlmsg_perm *tab, size_t tabsize) { - int i, err = -EINVAL; + u32 i; + int err = -EINVAL; for (i = 0; i < tabsize/sizeof(struct nlmsg_perm); i++) if (nlmsg_type == tab[i].nlmsg_type) {