summaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorNick Stoughton <nstoughton@logitech.com>2019-07-17 14:56:06 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 13:13:24 +0200
commit8d68efb7e270210eaaaa49284240977a5fc2d751 (patch)
treea3b76006c18a99d20036ec4f34bac6c748c3f711 /drivers/leds
parent3dee582e6190ca7c5225423aacee822be2cd2735 (diff)
downloadlinux-stable-8d68efb7e270210eaaaa49284240977a5fc2d751.tar.gz
linux-stable-8d68efb7e270210eaaaa49284240977a5fc2d751.tar.bz2
linux-stable-8d68efb7e270210eaaaa49284240977a5fc2d751.zip
leds: leds-lp5562 allow firmware files up to the maximum length
[ Upstream commit ed2abfebb041473092b41527903f93390d38afa7 ] 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 Fixes: ff45262a85db ("leds: add new LP5562 LED driver") Signed-off-by: Nick Stoughton <nstoughton@logitech.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp5562.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c
index 37632fc63741..edb57c42e8b1 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;