6e1106b4a9
gcc-11 warns about what appears to be an out-of-range array access but stop the build due to -Werror added to cflags: arch/sparc/kernel/mdesc.c: In function 'mdesc_node_by_name': arch/sparc/kernel/mdesc.c:647:22: error: 'strcmp' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] 647 | if (!strcmp(names + ep[ret].name_offset, name)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/sparc/kernel/mdesc.c:77:33: note: at offset 16 into source object 'mdesc' of size 16 77 | struct mdesc_hdr mdesc; | ^~~~~ arch/sparc/kernel/mdesc.c: In function 'mdesc_get_property': arch/sparc/kernel/mdesc.c:692:22: error: 'strcmp' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] 692 | if (!strcmp(names + ep->name_offset, name)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/sparc/kernel/mdesc.c:77:33: note: at offset 16 into source object 'mdesc' of size 16 77 | struct mdesc_hdr mdesc; | ^~~~~ arch/sparc/kernel/mdesc.c: In function 'mdesc_next_arc': arch/sparc/kernel/mdesc.c:719:21: error: 'strcmp' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread] 719 | if (strcmp(names + ep->name_offset, arc_type)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/sparc/kernel/mdesc.c:77:33: note: at offset 16 into source object 'mdesc' of size 16 77 | struct mdesc_hdr mdesc; | ^~~~~ cc1: all warnings being treated as errors The issue was initially reported to gcc [1] where it was analized. As suggested, change the struct mdesc_elem * accesses from the end of mdesc to those from the beginning of the data array. Update the prototype of node_block(), name_block() and data_block() since the code really seems to want to do is to compute the address somewhere into the chunk pointed to by hp. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100262 Upstream status: Pending https://www.spinics.net/lists/sparclinux/msg26385.html Signed-off-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> |
||
---|---|---|
.. | ||
aarch64-sbsa | ||
aarch64-virt | ||
arm-versatile | ||
arm-vexpress | ||
arm-vexpress-tz | ||
csky | ||
m68k-mcf5208 | ||
m68k-q800 | ||
microblazebe-mmu | ||
microblazeel-mmu | ||
mips32r2-malta | ||
mips32r2el-malta | ||
mips32r6-malta | ||
mips32r6el-malta | ||
mips64-malta | ||
mips64el-malta | ||
mips64r6-malta | ||
mips64r6el-malta | ||
nios2-10m50 | ||
or1k | ||
ppc64-e5500 | ||
ppc64-pseries | ||
ppc64le-pseries | ||
ppc-e500mc | ||
ppc-g3beige | ||
ppc-mac99 | ||
ppc-mpc8544ds | ||
riscv32-virt | ||
riscv64-virt | ||
s390x | ||
sh4-r2d | ||
sh4eb-r2d | ||
sparc64-sun4u | ||
sparc-ss10 | ||
x86 | ||
x86_64 | ||
xtensa-lx60 | ||
post-image.sh |