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-efi | ||
acmesystems | ||
altera/socrates_cyclone5 | ||
amarula | ||
andes | ||
arcturus | ||
arm | ||
armadeus | ||
arrow/avenger96 | ||
asus/tinker | ||
atmel | ||
avnet/s6lx9_microboard | ||
bananapi | ||
beagleboardx15 | ||
beaglebone | ||
beagleboneai | ||
beaglev | ||
beelink/gs1 | ||
boundarydevices/common | ||
chromebook | ||
ci20 | ||
csky | ||
cubietech/cubieboard2 | ||
embest/riotboard | ||
engicam | ||
firefly/roc-rk3399-pc | ||
freescale | ||
friendlyarm | ||
globalscale/espressobin | ||
grinn | ||
hardkernel | ||
intel/galileo | ||
kontron/smarc-sal28 | ||
lego/ev3 | ||
lemaker/bananapro | ||
librecomputer/lafrite | ||
licheepi | ||
linksprite/pcduino | ||
microchip | ||
minnowboard | ||
nexbox/a95x | ||
olimex | ||
olpc | ||
openblocks/a6 | ||
orangepi | ||
pandaboard | ||
pc | ||
pcengines/apu2 | ||
pine64 | ||
qemu | ||
qmtech/zynq | ||
radxa | ||
raspberrypi | ||
roseapplepi | ||
sheevaplug | ||
sifive/hifive-unleashed | ||
sinovoip | ||
solidrun | ||
stmicroelectronics | ||
synopsys | ||
technexion | ||
technologic | ||
toradex/apalis-imx6 | ||
udoo | ||
uevm5432 | ||
wandboard | ||
warp7 | ||
zynq | ||
zynqmp | ||
raspberrypi0 | ||
raspberrypi0w | ||
raspberrypi2 | ||
raspberrypi3 | ||
raspberrypi3-64 | ||
raspberrypi4 | ||
raspberrypi4-64 | ||
raspberrypicm4io | ||
raspberrypicm4io-64 |