aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-09-15 08:11:29 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-09-15 08:11:29 +0000
commitf4c8a12e26a80d0c07e66ad81aea2201a89d1d97 (patch)
treec616073152862564cf2181b6c7c2619de7b470cf
parent7c04a2116b70efbf1e071a4b52b363089453dcf3 (diff)
downloadbusybox-w32-f4c8a12e26a80d0c07e66ad81aea2201a89d1d97.tar.gz
busybox-w32-f4c8a12e26a80d0c07e66ad81aea2201a89d1d97.tar.bz2
busybox-w32-f4c8a12e26a80d0c07e66ad81aea2201a89d1d97.zip
comparison was always false due to limited range of data types.
Carefully cast to unsigned long long prior to multiply to get the expected result. git-svn-id: svn://busybox.net/trunk/busybox@7523 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--init/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c
index 8da358cb5..85792c9b7 100644
--- a/init/init.c
+++ b/init/init.c
@@ -333,7 +333,7 @@ static unsigned int check_free_memory(void)
333 s--; 333 s--;
334 } 334 }
335 result = (info.totalram >> s) + (info.totalswap >> s); 335 result = (info.totalram >> s) + (info.totalswap >> s);
336 if ((unsigned long long) (result * u) > UINT_MAX) { 336 if (((unsigned long long)result * (unsigned long long)u) > UINT_MAX) {
337 return(UINT_MAX); 337 return(UINT_MAX);
338 } else { 338 } else {
339 return(result * u); 339 return(result * u);