apparmor: Fix checking address of an array in accum_label_info()
authorNathan Chancellor <nathan@kernel.org>
Mon, 20 Jan 2025 13:12:01 +0000 (06:12 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 10 Feb 2025 19:16:30 +0000 (11:16 -0800)
commit509f8cb2fff927eeb5eb0ebdd410ec6f40430173
tree87d8b21faa318773a8945b97aaf1edb18764956a
parente6b087676954e36a7b1ed51249362bb499f8c1c2
apparmor: Fix checking address of an array in accum_label_info()

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>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/label.c