]> git.baikalelectronics.ru Git - kernel.git/commit
phy: mscc: fix printf format
authorArnd Bergmann <arnd@arndb.de>
Wed, 26 Sep 2018 13:20:11 +0000 (15:20 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Sep 2018 17:25:11 +0000 (10:25 -0700)
commitf5d7a929016d9938fc675e7707d578474c11bbab
tree1c8e3cb6353cad1ec071417b52730ceea68b4a4a
parenta8fe16aff59d7280b5d28d99f527f328256e005d
phy: mscc: fix printf format

gcc points out that the length of the temporary buffer may not be sufficient for
large numbers of leds:

drivers/net/phy/mscc.c: In function 'vsc85xx_probe':
drivers/net/phy/mscc.c:460:45: error: '-mode' directive writing 5 bytes into a region of size between 0 and 9 [-Werror=format-overflow=]
   ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i);
                                             ^~~~~
drivers/net/phy/mscc.c:460:9: note: 'sprintf' output between 19 and 28 bytes into a destination of size 22
   ret = sprintf(led_dt_prop, "vsc8531,led-%d-mode", i);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

While we can make a reasonable assumption that the number of LEDs is small,
the cost of making the buffer a little bigger is insignificant as well.

Fixes: 51e6f61c8abd ("net: phy: mscc: factorize code for LEDs mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/mscc.c