* [PATCH] apparmor: Fix checking address of an array in accum_label_info()
@ 2025-01-20 13:12 Nathan Chancellor
2025-01-24 21:59 ` John Johansen
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2025-01-20 13:12 UTC (permalink / raw)
To: John Johansen
Cc: apparmor, linux-security-module, llvm, patches, kernel test robot,
Nathan Chancellor
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>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] apparmor: Fix checking address of an array in accum_label_info()
2025-01-20 13:12 [PATCH] apparmor: Fix checking address of an array in accum_label_info() Nathan Chancellor
@ 2025-01-24 21:59 ` John Johansen
2025-01-31 18:21 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: John Johansen @ 2025-01-24 21:59 UTC (permalink / raw)
To: Nathan Chancellor
Cc: apparmor, linux-security-module, llvm, patches, kernel test robot
On 1/20/25 05:12, Nathan Chancellor wrote:
> 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>
Acked-by: John Johansen <john.johansen@canonical.com>
I have pulled this into my tree
> ---
> 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,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] apparmor: Fix checking address of an array in accum_label_info()
2025-01-24 21:59 ` John Johansen
@ 2025-01-31 18:21 ` Nathan Chancellor
0 siblings, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-01-31 18:21 UTC (permalink / raw)
To: John Johansen
Cc: apparmor, linux-security-module, llvm, patches, kernel test robot
On Fri, Jan 24, 2025 at 01:59:36PM -0800, John Johansen wrote:
> On 1/20/25 05:12, Nathan Chancellor wrote:
> > 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>
>
> Acked-by: John Johansen <john.johansen@canonical.com>
>
> I have pulled this into my tree
Thanks! Is this going to be pushed to -next soon? I am still seeing this
on next-20240131.
> > ---
> > 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,
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-31 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 13:12 [PATCH] apparmor: Fix checking address of an array in accum_label_info() Nathan Chancellor
2025-01-24 21:59 ` John Johansen
2025-01-31 18:21 ` Nathan Chancellor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).