Message ID | 20230807171143.208481-6-cgzones@googlemail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1630272vqr; Mon, 7 Aug 2023 11:22:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfP1+5Q2vZgIOshvLsG7qheU7NLxQ3J0aEST2ffqpP+FruTfMTo2PQflo3cj44eWGFQaZp X-Received: by 2002:a05:6a20:42a0:b0:130:835b:e260 with SMTP id o32-20020a056a2042a000b00130835be260mr10263379pzj.52.1691432579131; Mon, 07 Aug 2023 11:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691432579; cv=none; d=google.com; s=arc-20160816; b=svreMc3IBnWFw5xB0qvSMQ9rV8TgFS/5iQf56/J0cGZeY2Dh2QW4Gj4lLLepQ2jcvV i5BZxU8Z4BeikMBDaKvv5LDJ1jTxotWZMYkXNrst/g4XY7I/YYW+QJh5SPJjJhBniUel nk+DltLfbt3x7l/5IE72xOQ/wOMjUSuq4AvaoMNFpOhe8TbLQ8gtzaSVvzWiKwxOtE6Q 9blJSGvyvngdYPPIwifFqAJDZ0q1Yl0oXa1czuxjb2MfcNN9PYbiU742WsWmMKeO15QV npeOWE7DBZwcu151X697PZ8tQIr+GVl9jH3IbBDWHFyR12S4orjwi5qeDG7VfhzDfOck A1Ww== 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=5PO+ab1xjCHdDkh5lalW/5rufzTS+75sAkJKeFh3jcU=; fh=QKur2PFwoLuCt27JzfZM4LabS9ldoGoSAJNPH9t/KWI=; b=HYctfRJEjZwEY9BUVWeZVSxAkbtoywJHqaqsrXIjVIoqq2bmnpP7UK/+f+fV5rZfAl iSjxe6EEDp3QCN5vH/f6QQ0J8pAxvKNkY9KdcRJO+O0Sez93kuZIrMObnqbYtaLIxrNP mcoDcHtPnXRey4NmJT/t+ZW0Z9I8PqmtOWU3pf1nsyfA3IjTRa+KmS8YoCaW8NQy+7Zx Nke7zEAPzVMe8KP251tZqV7oUE1Igc7L5s1sfNWosYl9TlQLp2lAbAgz9cgWUHl+l2U8 +lOStqOttumn7oF8RFNZFohrXmB/CRRnYX1bTZ1F85aXo4sVEBMgdDi0SDyczbCUN3fE 9XoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20221208 header.b=MkS2i21E; 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 x185-20020a6363c2000000b00563dd9beae8si5910885pgb.594.2023.08.07.11.22.46; Mon, 07 Aug 2023 11:22:59 -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=MkS2i21E; 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 S232052AbjHGRMP (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 13:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231815AbjHGRMA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 13:12:00 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303FFE67; Mon, 7 Aug 2023 10:11:59 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so6162910a12.0; Mon, 07 Aug 2023 10:11:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20221208; t=1691428317; x=1692033117; 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=5PO+ab1xjCHdDkh5lalW/5rufzTS+75sAkJKeFh3jcU=; b=MkS2i21E0eUYZCqU8XweZu22TzsncxX4VTS06KQvJSYwH9QRy8661yD5GMaT08UZ1i CYlsCjWYpVTk8L1W8elqZn8rKZ0ZlpRgRrpx1BTnKs8UUEepzIF5n5v3L2qC4ztZSNeo YD+vCy+k3Lqe1uqXuU1+DFQdsO4qP//RdGAdz69XQfGSvnbIMWH2cMbGJtfha/NaWhia ljj8QFK+04+d5JxmwekasLXudLSK0Gcer6pcLgorZd7yS6cy6cAd5oa8GrGuWM/rAoa5 HkJ7qQ5b3ib156BJ4zf0RanM5hK7BPylzrTBBnfsnjsTXLcen6TzISYubJnBjgAadVyd J5iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691428317; x=1692033117; 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=5PO+ab1xjCHdDkh5lalW/5rufzTS+75sAkJKeFh3jcU=; b=dU/tVbMa4xvq3ZtatWRqJPSPz8aphXHlHwgy/YfOJxsPFDQay8v5xdJZYgJzqamjiy tU3hqsROnzGkzaA6jQpYwvKUoCME7rqfdv2zrbjqWxLivYccBVFwJE72zSYlxi86TLVP taLGONuKmpqiUXYV1hfIcSmj1gXUTbSCle6DDWHJXCF2Vy86Fe/PbrB39eqTNKjaU9KX 2ii+98imCH0/PjeafLrk4bJ/77R3W2pchko0wWPgNrgP9cTedDOClNc2pBa1PjcVn6zm XMbMrpXLFYaO56W1yaRnaVDkD1ZxTR03LQnBeN+T/PbJZxvTTnk9reutsDKtG06YPyyv ej0w== X-Gm-Message-State: AOJu0Yxq2sDJqDkB4ERE0duiKWC8zkr7Wp8WzSB88ma/+b3Tk6FSmgMY viplGpYGGsfcUDmPCAk37ITY7BSvgUl4Sg== X-Received: by 2002:aa7:d745:0:b0:523:100b:462b with SMTP id a5-20020aa7d745000000b00523100b462bmr9455129eds.5.1691428317675; Mon, 07 Aug 2023 10:11:57 -0700 (PDT) Received: from debian_development.DebianHome (dynamic-095-112-033-028.95.112.pool.telefonica.de. [95.112.33.28]) by smtp.gmail.com with ESMTPSA id e10-20020a056402148a00b005224d960e66sm5420814edv.96.2023.08.07.10.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 10:11:57 -0700 (PDT) From: =?utf-8?q?Christian_G=C3=B6ttsche?= <cgzones@googlemail.com> To: selinux@vger.kernel.org Cc: Paul Moore <paul@paul-moore.com>, Stephen Smalley <stephen.smalley.work@gmail.com>, Eric Paris <eparis@parisplace.org>, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/7] selinux: use unsigned iterator in nlmsgtab code Date: Mon, 7 Aug 2023 19:11:41 +0200 Message-Id: <20230807171143.208481-6-cgzones@googlemail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230807171143.208481-1-cgzones@googlemail.com> References: <20230807171143.208481-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773595608529520485 X-GMAIL-MSGID: 1773595608529520485 |
Series |
[v3,1/7] selinux: avoid implicit conversions in avtab code
|
|
Commit Message
Christian Göttsche
Aug. 7, 2023, 5:11 p.m. UTC
Use an unsigned type as loop iterator.
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v3: use unsigned int instead of u32 since the loop bound is known at
compile time and small (<100)
v2: avoid declarations in init-clauses of for loops
---
security/selinux/nlmsgtab.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Aug 7, 2023 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com> wrote: > > Use an unsigned type as loop iterator. > > Signed-off-by: Christian Göttsche <cgzones@googlemail.com> > --- > v3: use unsigned int instead of u32 since the loop bound is known at > compile time and small (<100) > v2: avoid declarations in init-clauses of for loops > --- > security/selinux/nlmsgtab.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Merged into selinux/next, thanks. -- paul-moore.com
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 2ee7b4ed43ef..8ff670cf1ee5 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; + unsigned int i; + int err = -EINVAL; for (i = 0; i < tabsize/sizeof(struct nlmsg_perm); i++) if (nlmsg_type == tab[i].nlmsg_type) {