From: Pavel Machek <pavel@ucw.cz>
To: Nick Stoughton <nstoughton@logitech.com>
Cc: linux-leds@vger.kernel.org
Subject: Re: [PATCH] leds: leds-lp5562 allow firmware files up to the maximum length
Date: Wed, 10 Jul 2019 21:16:57 +0200 [thread overview]
Message-ID: <20190710191657.GE22995@amd> (raw)
In-Reply-To: <CACpbN90YPxnsm1Py4t2-npk0b8A06+OZTtc8kom_smMDUyFEVw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]
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 <nstoughton@logitech.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2019-07-10 19:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 14:30 [PATCH] leds: leds-lp5562 allow firmware files up to the maximum length Nick Stoughton
2019-07-10 19:16 ` Pavel Machek [this message]
2019-07-15 21:16 ` Jacek Anaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190710191657.GE22995@amd \
--to=pavel@ucw.cz \
--cc=linux-leds@vger.kernel.org \
--cc=nstoughton@logitech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).