Skip to contentSkip to conversation

cmd: itest: correct calculus for long format

PATCH New Andy Shevchenko 5 participants 7 messages Feb 10, 2017 – Mar 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

From: Sebastien Colleur <[email protected]>

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

---
 cmd/itest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
cmd/itest.c +2 -1
index 60626c7fe9..e1896d9f97 100644
@@ -80,7 +80,8 @@ static long evalexp(char *s, int w)
 		l = simple_strtoul(s, NULL, 16);
 	}
 
-	return l & ((1UL << (w * 8)) - 1);
+	/* avoid overflow on mask calculus */
+	return (w >= sizeof(long)) ? l : (l & ((1UL << (w * 8)) - 1));
 }
 
 static char * evalstr(char *s)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

Quoted 10 lines · Andy Shevchenko

From: Sebastien Colleur <[email protected]>

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

---
 cmd/itest.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Seems reasonable to me.

#2 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

Quoted 9 lines · Simon Glass
Quoted 5 lines · Andy Shevchenko

From: Sebastien Colleur <[email protected]>

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

Thanks!

To whom should I send this to get it applied? Or just wait when maintainers pick this up?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

Quoted 9 lines · Andy Shevchenko
Quoted 7 lines · Simon Glass
Quoted 5 lines · Andy Shevchenko

From: Sebastien Colleur <[email protected]>

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

Quoted 6 lines
Quoted 1 line

Thanks!

To whom should I send this to get it applied? Or just wait when maintainers pick this up?

As this patch doesn't fall into a special custodian responsibility, Tom usually keeps track of it and will apply it - most likely after the next release. But it's always a good idea to check from time to time, if such patches have been applied and "ping" again if not.

Thanks,
Stefan

#4 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

Quoted 9 lines · Stefan Roese
Quoted 2 lines · Andy Shevchenko

To whom should I send this to get it applied? Or just wait when maintainers pick this up?

As this patch doesn't fall into a special custodian responsibility, Tom usually keeps track of it and will apply it - most likely after the next release. But it's always a good idea to check from time to time, if such patches have been applied and "ping" again if not.

Okay, thanks for clarification.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

In reply to Stefan Roese
Quoted 13 lines · Stefan Roese
Quoted 12 lines · Andy Shevchenko
Quoted 8 lines · Simon Glass
Quoted 3 lines · Andy Shevchenko

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

Thanks!

Quoted 7 lines
Quoted 2 lines

To whom should I send this to get it applied? Or just wait when maintainers pick this up?

As this patch doesn't fall into a special custodian responsibility, Tom usually keeps track of it and will apply it - most likely after the next release. But it's always a good idea to check from time to time, if such patches have been applied and "ping" again if not.

Tom, there is no such in -rc3, please apply if no objections.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

PATCH 1/1 cmd: itest: correct calculus for long format

In reply to Andy Shevchenko
Quoted 8 lines · Andy Shevchenko

From: Sebastien Colleur <[email protected]>

itest shell command doesn't work correctly in long format when doing comparaison due to wrong mask value calculus that overflow on 32 bits values.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170317/2f2da1c3/attachment.sig>