On Wed 2019-07-10 07:30:31, Nick Stoughton wrote: > Firmware files are in ASCII, using 2 hex characters per byte. The > maximum length of a firmware string is therefore > > 16 (commands) * 2 (bytes per command) * 2 (characters per byte) = 64 > > Signed-off-by: Nick Stoughton Acked-by: Pavel Machek Pavel > --- > drivers/leds/leds-lp5562.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c > index 37632fc63741..e00117e3b50d 100644 > --- a/drivers/leds/leds-lp5562.c > +++ b/drivers/leds/leds-lp5562.c > @@ -260,7 +260,11 @@ static void lp5562_firmware_loaded(struct > lp55xx_chip *chip) > { > const struct firmware *fw = chip->fw; > > - if (fw->size > LP5562_PROGRAM_LENGTH) { > + /* > + * the firmware is encoded in ascii hex character, with 2 chars > + * per byte > + */ > + if (fw->size > (LP5562_PROGRAM_LENGTH * 2)) { > dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n", > fw->size); > return; -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html