aboutsummaryrefslogtreecommitdiff
path: root/tests/testutils.c
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2008-10-06 21:12:28 +0000
committerEric B Munson <ebmunson@us.ibm.com>2008-10-09 15:16:51 +0100
commitf0472c8a7172a76c01d7f24f60aefd327f4793fc (patch)
tree83597910d26e9b15c52bbb0ed3a9b34883f798e6 /tests/testutils.c
parent1ddd2f8b5bbaf95330a945d6d9bb2369aa5c257c (diff)
downloadlibhugetlbfs-f0472c8a7172a76c01d7f24f60aefd327f4793fc.tar.gz
tests: Avoid call to gethugepagesize it could be unsafe
The function select_pool_counter() may be called by a test that does not link to libhugetlbfs. Therefore it is unsafe to call gethugepagesize because that function may not always be available. Also, the default size is already known so just use the value that has already been determined. Signed-off-by: Adam Litke <agl@us.ibm.com> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'tests/testutils.c')
-rw-r--r--tests/testutils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/testutils.c b/tests/testutils.c
index 910d116..6534e9c 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -321,7 +321,7 @@ int select_pool_counter(unsigned int counter, unsigned long pagesize,
/* Convert a pagesize of 0 to the libhugetlbfs default size */
if (pagesize == 0)
- pagesize = gethugepagesize();
+ pagesize = default_size;
/* If the user is dealing in the default page size, we can use /proc */
if (pagesize == default_size) {