All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: leds-lp5562 allow firmware files up to the maximum length
@ 2019-07-10 14:30 Nick Stoughton
  2019-07-10 19:16 ` Pavel Machek
  2019-07-15 21:16 ` Jacek Anaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Stoughton @ 2019-07-10 14:30 UTC (permalink / raw)
  To: linux-leds

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>
---
 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;
-- 
Nick Stoughton

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] leds: leds-lp5562 allow firmware files up to the maximum length
  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
  2019-07-15 21:16 ` Jacek Anaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2019-07-10 19:16 UTC (permalink / raw)
  To: Nick Stoughton; +Cc: linux-leds

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] leds: leds-lp5562 allow firmware files up to the maximum length
  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
@ 2019-07-15 21:16 ` Jacek Anaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Jacek Anaszewski @ 2019-07-15 21:16 UTC (permalink / raw)
  To: Nick Stoughton, linux-leds

Hi Nick,

Thank you for the patch. Unfortunately it doesn't apply:

$ git am \[PATCH\]\ leds\:\ leds-lp5562\ allow\ firmware\ files\ up\ to\
the\ maximum\ length.eml
Applying: leds: leds-lp5562 allow firmware files up to the maximum length
error: corrupt patch at line 10
...

I don't know where is the problem exactly, but you seem to have copied
the patch created with "git format-patch" and copy-pasted it to the
message composer window. Please send the patch using
"git send-email".

Best regards,
Jacek Anaszewski


On 7/10/19 4:30 PM, 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>
> ---
>  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;
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-15 21:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-07-15 21:16 ` Jacek Anaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.