When calling gethugepagesizes in a 32 bit environment it is possible that
some page sizeds will not be representable in the result.  Ensure we detect
and elide these.

Signed-off-by: Andy Whitcroft <[EMAIL PROTECTED]>
Acked-by: Mel Gorman <[EMAIL PROTECTED]>
---
 hugeutils.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hugeutils.c b/hugeutils.c
index afd6933..bad5dfe 100644
--- a/hugeutils.c
+++ b/hugeutils.c
@@ -613,9 +613,9 @@ int gethugepagesizes(long pagesizes[], int n_elem)
                size = strtol(ent->d_name + 10, NULL, 10);
                if (size == LONG_MIN || size == LONG_MAX)
                        continue;
-               size *= 1024; /* Convert from KB to Bytes */
+               size = size_to_smaller_unit(size);
 
-               if (size == default_size)
+               if (size < 0 || size == default_size)
                        continue;
                if (n_elem && pagesizes)
                        pagesizes[nr_sizes] = size;
-- 
1.6.0.1.451.gc8d31


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to