Skip to content

Commit d4f79cb

Browse files
arndbolofj
authored andcommitted
ARM: orion: avoid VLA in orion_mpp_conf
Testing randconfig builds found an instance of a VLA that was missed when determining that we have removed them all: arch/arm/plat-orion/mpp.c: In function 'orion_mpp_conf': arch/arm/plat-orion/mpp.c:31:2: error: ISO C90 forbids variable length array 'mpp_ctrl' [-Werror=vla] This one is fairly straightforward: we know what all three callers are, and the maximum length is not very long. Fixes: 6866469 ("Makefile: Globally enable VLA warning") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Olof Johansson <olof@lixom.net>
1 parent 513eb98 commit d4f79cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

arch/arm/plat-orion/mpp.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
2828
unsigned int mpp_max, void __iomem *dev_bus)
2929
{
3030
unsigned int mpp_nr_regs = (1 + mpp_max/8);
31-
u32 mpp_ctrl[mpp_nr_regs];
31+
u32 mpp_ctrl[8];
3232
int i;
3333

3434
printk(KERN_DEBUG "initial MPP regs:");
35+
if (mpp_nr_regs > ARRAY_SIZE(mpp_ctrl)) {
36+
printk(KERN_ERR "orion_mpp_conf: invalid mpp_max\n");
37+
return;
38+
}
39+
3540
for (i = 0; i < mpp_nr_regs; i++) {
3641
mpp_ctrl[i] = readl(mpp_ctrl_addr(i, dev_bus));
3742
printk(" %08x", mpp_ctrl[i]);

0 commit comments

Comments
 (0)