Skip to content

Commit

Permalink
ARM: orion: avoid VLA in orion_mpp_conf
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Olof Johansson <[email protected]>
  • Loading branch information
arndb authored and olofj committed Nov 3, 2018
1 parent 513eb98 commit d4f79cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm/plat-orion/mpp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask,
unsigned int mpp_max, void __iomem *dev_bus)
{
unsigned int mpp_nr_regs = (1 + mpp_max/8);
u32 mpp_ctrl[mpp_nr_regs];
u32 mpp_ctrl[8];
int i;

printk(KERN_DEBUG "initial MPP regs:");
if (mpp_nr_regs > ARRAY_SIZE(mpp_ctrl)) {
printk(KERN_ERR "orion_mpp_conf: invalid mpp_max\n");
return;
}

for (i = 0; i < mpp_nr_regs; i++) {
mpp_ctrl[i] = readl(mpp_ctrl_addr(i, dev_bus));
printk(" %08x", mpp_ctrl[i]);
Expand Down

0 comments on commit d4f79cb

Please sign in to comment.