MIPS: Alchemy: Fix an out-of-bound access in db1200_dev_setup()
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 10 Jan 2024 18:07:36 +0000 (19:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jan 2024 23:35:50 +0000 (15:35 -0800)
[ Upstream commit 89c4b588d11e9acf01d604de4b0c715884f59213 ]

When calling spi_register_board_info(), we should pass the number of
elements in 'db1200_spi_devs', not 'db1200_i2c_devs'.

Fixes: 63323ec54a7e ("MIPS: Alchemy: Extended DB1200 board support.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/mips/alchemy/devboards/db1200.c

index f521874..67f0677 100644 (file)
@@ -847,7 +847,7 @@ int __init db1200_dev_setup(void)
        i2c_register_board_info(0, db1200_i2c_devs,
                                ARRAY_SIZE(db1200_i2c_devs));
        spi_register_board_info(db1200_spi_devs,
-                               ARRAY_SIZE(db1200_i2c_devs));
+                               ARRAY_SIZE(db1200_spi_devs));
 
        /* SWITCHES:    S6.8 I2C/SPI selector  (OFF=I2C  ON=SPI)
         *              S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)