mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
47307c31d9
Building with -Warray-bounds showed a stack variable array index
overflow. Increase the expected size of the array to avoid the warning:
In file included from ./include/linux/printk.h:555,
from ./include/asm-generic/bug.h:22,
from ./arch/x86/include/asm/bug.h:84,
from ./include/linux/bug.h:5,
from ./include/linux/mmdebug.h:5,
from ./include/linux/gfp.h:5,
from ./include/linux/firmware.h:7,
from drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c:5:
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c: In function 'otx2_cpt_print_uc_dbg_info':
./include/linux/dynamic_debug.h:162:33: warning: array subscript 4 is above array bounds of 'u32[4]' {aka 'unsigned int[4]'} [-Warray-bounds]
162 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^
./include/linux/dynamic_debug.h:134:17: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~
./include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
162 | _dynamic_func_call(fmt, __dynamic_pr_debug, \
| ^~~~~~~~~~~~~~~~~~
./include/linux/printk.h:570:9: note: in expansion of macro 'dynamic_pr_debug'
570 | dynamic_pr_debug(fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c:1807:41: note: in expansion of macro 'pr_debug'
1807 | pr_debug("Mask: %8.8x %8.8x %8.8x %8.8x %8.8x",
| ^~~~~~~~
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c:1765:13: note: while referencing 'mask'
1765 | u32 mask[4];
| ^~~~
This is justified because the mask size (eng_grps->engs_num) can be at
most 144 (OTX2_CPT_MAX_ENGINES bits), which is larger than available
storage. 4 * 32 == 128, so this must be 5: 5 * 32bit = 160.
Additionally clear the mask before conversion so trailing bits are zero.
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: Arnaud Ebalard <arno@natisbad.org>
Cc: Srujana Challa <schalla@marvell.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Suheil Chandran <schandran@marvell.com>
Cc: Shijith Thotton <sthotton@marvell.com>
Cc: Lukasz Bartosik <lbartosik@marvell.com>
Cc: linux-crypto@vger.kernel.org
Fixes:
|
||
---|---|---|
.. | ||
allwinner | ||
amcc | ||
amlogic | ||
axis | ||
bcm | ||
caam | ||
cavium | ||
ccp | ||
ccree | ||
chelsio | ||
gemini | ||
hisilicon | ||
inside-secure | ||
keembay | ||
marvell | ||
nx | ||
qat | ||
qce | ||
rockchip | ||
stm32 | ||
ux500 | ||
virtio | ||
vmx | ||
xilinx | ||
atmel-aes-regs.h | ||
atmel-aes.c | ||
atmel-authenc.h | ||
atmel-ecc.c | ||
atmel-i2c.c | ||
atmel-i2c.h | ||
atmel-sha204a.c | ||
atmel-sha-regs.h | ||
atmel-sha.c | ||
atmel-tdes-regs.h | ||
atmel-tdes.c | ||
exynos-rng.c | ||
geode-aes.c | ||
geode-aes.h | ||
hifn_795x.c | ||
img-hash.c | ||
ixp4xx_crypto.c | ||
Kconfig | ||
Makefile | ||
mxs-dcp.c | ||
n2_asm.S | ||
n2_core.c | ||
n2_core.h | ||
omap-aes-gcm.c | ||
omap-aes.c | ||
omap-aes.h | ||
omap-crypto.c | ||
omap-crypto.h | ||
omap-des.c | ||
omap-sham.c | ||
padlock-aes.c | ||
padlock-sha.c | ||
qcom-rng.c | ||
s5p-sss.c | ||
sa2ul.c | ||
sa2ul.h | ||
sahara.c | ||
talitos.c | ||
talitos.h |