security/apparmor/label.c:206:15: warning: address of array 'new->vec' will always evaluate to 'true'
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next head: e6b087676954e36a7b1ed51249362bb499f8c1c2 commit: de4754c801f4ceefc6ce0d13480c506e0a91b449 [9/19] apparmor: carry mediation check on label config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250119/[email protected]/config) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250119/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from security/apparmor/label.c:10:
In file included from include/linux/audit.h:13:
In file included from include/linux/ptrace.h:10:
In file included from include/linux/pid_namespace.h:7:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> security/apparmor/label.c:206:15: warning: address of array 'new->vec' will always evaluate to 'true' [-Wpointer-bool-conversion]
206 | AA_BUG(!new->vec);
| ~~~~~~^~~
security/apparmor/include/lib.h:56:15: note: expanded from macro 'AA_BUG'
56 | AA_BUG_FMT((X), "" args); \
| ^
security/apparmor/include/lib.h:61:8: note: expanded from macro 'AA_BUG_FMT'
61 | WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)
| ^
include/asm-generic/bug.h:132:25: note: expanded from macro 'WARN'
132 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~5 warnings generated.
vim +206 security/apparmor/label.c
200
201 static void accum_label_info(struct aa_label *new)
202 {
203 long u = FLAG_UNCONFINED;
204 int i;
205
> 206 AA_BUG(!new->vec);
207
208 /* size == 1 is a profile and flags must be set as part of creation */
209 if (new->size == 1)
210 return;
211
212 for (i = 0; i < new->size; i++) {
213 u |= new->vec[i]->label.flags & (FLAG_DEBUG1 | FLAG_DEBUG2 |
214 FLAG_STALE);
215 if (!(u & new->vec[i]->label.flags & FLAG_UNCONFINED))
216 u &= ~FLAG_UNCONFINED;
217 new->mediates |= new->vec[i]->label.mediates;
218 }
219 new->flags |= u;
220 }
221
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki