From: Nathan Chancellor <nathan@kernel.org>
To: John Johansen <john.johansen@canonical.com>
Cc: apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org,
llvm@lists.linux.dev, patches@lists.linux.dev,
kernel test robot <lkp@intel.com>,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] apparmor: Fix checking address of an array in accum_label_info()
Date: Mon, 20 Jan 2025 06:12:01 -0700 [thread overview]
Message-ID: <20250120-apparmor-pointer-bool-conversion-label-v1-1-5957d28ffde6@kernel.org> (raw)
clang warns:
security/apparmor/label.c:206:15: error: address of array 'new->vec' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
206 | AA_BUG(!new->vec);
| ~~~~~~^~~
The address of this array can never be NULL because it is not at the
beginning of a structure. Convert the assertion to check that the new
pointer is not NULL.
Fixes: de4754c801f4 ("apparmor: carry mediation check on label")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501191802.bDp2voTJ-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
security/apparmor/label.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/apparmor/label.c b/security/apparmor/label.c
index afded9996f61..79be2d3d604b 100644
--- a/security/apparmor/label.c
+++ b/security/apparmor/label.c
@@ -203,7 +203,7 @@ static void accum_label_info(struct aa_label *new)
long u = FLAG_UNCONFINED;
int i;
- AA_BUG(!new->vec);
+ AA_BUG(!new);
/* size == 1 is a profile and flags must be set as part of creation */
if (new->size == 1)
---
base-commit: e6b087676954e36a7b1ed51249362bb499f8c1c2
change-id: 20250120-apparmor-pointer-bool-conversion-label-7c1027964c7f
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
next reply other threads:[~2025-01-20 13:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-20 13:12 Nathan Chancellor [this message]
2025-01-24 21:59 ` [PATCH] apparmor: Fix checking address of an array in accum_label_info() John Johansen
2025-01-31 18:21 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250120-apparmor-pointer-bool-conversion-label-v1-1-5957d28ffde6@kernel.org \
--to=nathan@kernel.org \
--cc=apparmor@lists.ubuntu.com \
--cc=john.johansen@canonical.com \
--cc=linux-security-module@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=patches@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox