]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - cmd/itest.c
omap3_logic: Fix Environmental location
[people/ms/u-boot.git] / cmd / itest.c
index 60626c7fe9c3d983d247aeee6f89b76548a189b5..70db04a04f239e917e5f867a41804b965d62fd89 100644 (file)
@@ -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)
@@ -100,7 +101,7 @@ static char * evalstr(char *s)
                        i++;
                }
                s[i] = 0;
-               return  getenv((const char *)&s[2]);
+               return  env_get((const char *)&s[2]);
        } else {
                return s;
        }