test_utils: fix test_addr_huge for anon pages

If the address being tested resides in an anon region that immediately
follows a hugetlb region, test_addr_huge erroneously reports the address
as huge.

Extract from /proc/self/maps:
02000000-02200000 rwxp 00000000 00:12 34122                              
/libhugetlbfs/libhugetlbfs.tmp.3HOwRf (deleted)
02200000-02221000 rw-p 02200000 00:00 0 

Test case: test_addr_huge(0x2200010) returns 1.

diff -u libhugetlbfs-dev-20070330/tests/testutils.c{.ORIG,}
--- libhugetlbfs-dev-20070330/tests/testutils.c.ORIG    2007-03-30 
09:40:25.000000000 -0500
+++ libhugetlbfs-dev-20070330/tests/testutils.c 2007-05-09 17:48:14.533270000 
-0500
@@ -101,6 +101,7 @@
                if (!tmp)
                        break;
 
+               buf[0] = '\0';
                ret = sscanf(line, "%lx-%lx %*s %lx %*s %ld %255s",
                             &start, &end, &off, &ino,
                             buf);

-Andrew Hastings
 Cray Inc.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to