Hi everyone,
When I build arm64 kernel with GCC 12.1.0 (bcm2711_defconfig), I get partly outside array bounds warning on fs/jffs2/summary.c:
CC [M] fs/jffs2/summary.o In file included from fs/jffs2/summary.c:23: In function 'jffs2_sum_add_mem', inlined from 'jffs2_sum_add_inode_mem' at fs/jffs2/summary.c:130:9: fs/jffs2/nodelist.h:43:28: warning: array subscript 'union jffs2_sum_mem[0]' is partly outside array bounds of 'unsigned char[26]' [-Warray-bounds] 43 | #define je16_to_cpu(x) ((x).v16) | ~~~~^~~~~ fs/jffs2/summary.c:71:17: note: in expansion of macro 'je16_to_cpu' 71 | switch (je16_to_cpu(item->u.nodetype)) { | ^~~~~~~~~~~ In file included from fs/jffs2/summary.c:17: In function 'kmalloc', inlined from 'jffs2_sum_add_inode_mem' at fs/jffs2/summary.c:118:37: ./include/linux/slab.h:600:24: note: object of size 26 allocated by 'kmem_cache_alloc_trace' 600 | return kmem_cache_alloc_trace( | ^~~~~~~~~~~~~~~~~~~~~~~ 601 | kmalloc_caches[kmalloc_type(flags)][index], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | flags, size); | ~~~~~~~~~~~~ In file included from fs/jffs2/nodelist.h:22: In function 'jffs2_sum_add_mem', inlined from 'jffs2_sum_add_inode_mem' at fs/jffs2/summary.c:130:9: fs/jffs2/summary.c:79:73: warning: array subscript 'union jffs2_sum_mem[0]' is partly outside array bounds of 'unsigned char[26]' [-Warray-bounds] 79 | s->sum_size += JFFS2_SUMMARY_DIRENT_SIZE(item->d.nsize); fs/jffs2/summary.h:34:80: note: in definition of macro 'JFFS2_SUMMARY_DIRENT_SIZE' 34 | #define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct jffs2_sum_dirent_flash) + (x)) | ^ In function 'kmalloc', inlined from 'jffs2_sum_add_inode_mem' at fs/jffs2/summary.c:118:37: ./include/linux/slab.h:600:24: note: object of size 26 allocated by 'kmem_cache_alloc_trace' 600 | return kmem_cache_alloc_trace( | ^~~~~~~~~~~~~~~~~~~~~~~ 601 | kmalloc_caches[kmalloc_type(flags)][index], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 602 | flags, size); | ~~~~~~~~~~~~
I first found these warnings when reviewing linux-5.18.y stable rc [1], for which Greg recommends me to contact JFFS subsystem developers.
Thanks.
[1]: https://lore.kernel.org/stable/YpxU%2FbVogip64iQF@debian.me/
linux-stable-mirror@lists.linaro.org