瀏覽代碼

Fix itest mask overflow

The mask value used in itest overflows and therefore it can return an
incorrect result for something like 'itest 0 == 1'. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 11 年之前
父節點
當前提交
c9bcb6f13d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      common/cmd_itest.c

+ 1 - 1
common/cmd_itest.c

@@ -63,7 +63,7 @@ static long evalexp(char *s, int w)
 		l = simple_strtoul(s, NULL, 16);
 	}
 
-	return (l & ((1 << (w * 8)) - 1));
+	return l & ((1UL << (w * 8)) - 1);
 }
 
 static char * evalstr(char *s)