[U-Boot] [PATCH v1] cmd: itest: correct calculus for long format

From: Sebastien Colleur sebastienx.colleur@intel.com
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.
Signed-off-by: Sebastien Colleur sebastienx.colleur@intel.com --- cmd/itest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/itest.c b/cmd/itest.c index 60626c7fe9..e1896d9f97 100644 --- a/cmd/itest.c +++ b/cmd/itest.c @@ -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)

On 10 February 2017 at 05:59, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
From: Sebastien Colleur sebastienx.colleur@intel.com
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.
Signed-off-by: Sebastien Colleur sebastienx.colleur@intel.com
cmd/itest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Seems reasonable to me.
Reviewed-by: Simon Glass sjg@chromium.org

On Fri, Feb 10, 2017 at 8:38 PM, Simon Glass sjg@chromium.org wrote:
On 10 February 2017 at 05:59, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
From: Sebastien Colleur sebastienx.colleur@intel.com
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.
Reviewed-by: Simon Glass sjg@chromium.org
Thanks!
To whom should I send this to get it applied? Or just wait when maintainers pick this up?

On 17.02.2017 13:57, Andy Shevchenko wrote:
On Fri, Feb 10, 2017 at 8:38 PM, Simon Glass sjg@chromium.org wrote:
On 10 February 2017 at 05:59, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
From: Sebastien Colleur sebastienx.colleur@intel.com
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.
Reviewed-by: Simon Glass sjg@chromium.org
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

On Fri, Feb 17, 2017 at 3:00 PM, Stefan Roese sr@denx.de wrote:
On 17.02.2017 13:57, Andy Shevchenko wrote:
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.

On Fri, Feb 17, 2017 at 3:00 PM, Stefan Roese sr@denx.de wrote:
On 17.02.2017 13:57, Andy Shevchenko wrote:
On Fri, Feb 10, 2017 at 8:38 PM, Simon Glass sjg@chromium.org wrote:
On 10 February 2017 at 05:59, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
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.
Reviewed-by: Simon Glass sjg@chromium.org
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.
Tom, there is no such in -rc3, please apply if no objections.

On Fri, Feb 10, 2017 at 03:59:15PM +0300, Andy Shevchenko wrote:
From: Sebastien Colleur sebastienx.colleur@intel.com
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.
Signed-off-by: Sebastien Colleur sebastienx.colleur@intel.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (5)
-
Andy Shevchenko
-
Andy Shevchenko
-
Simon Glass
-
Stefan Roese
-
Tom Rini