The function hugetlbfs_test_feature currently returns 0 if the requested feature is not present, a positive integer if the feature is present, and -ENOSYS if the requested feature is invalid. The way that hugetlbfs_test_feature is currently used is any non-zero return value means the requested feature is present. This patch corrects this usage to use only positive integer return values to mean a feature is present.
Signed-off-by: Eric B Munson <[email protected]> --- hugeutils.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hugeutils.c b/hugeutils.c index 3a9501f..4e6afd8 100644 --- a/hugeutils.c +++ b/hugeutils.c @@ -318,7 +318,7 @@ void hugetlbfs_check_priv_resv() * prefaulting the huge pages we allocate since the kernel * guarantees them. This can help NUMA performance quite a bit. */ - if (hugetlbfs_test_feature(HUGETLB_FEATURE_PRIVATE_RESV)) { + if (hugetlbfs_test_feature(HUGETLB_FEATURE_PRIVATE_RESV) > 0) { INFO("Kernel has MAP_PRIVATE reservations. Disabling " "heap prefaulting.\n"); __hugetlbfs_prefault = 0; @@ -333,7 +333,7 @@ void hugetlbfs_check_safe_noreserve() * the user of NORESERVE where necessary */ if (__hugetlb_opts.no_reserve && - !hugetlbfs_test_feature(HUGETLB_FEATURE_SAFE_NORESERVE)) { + hugetlbfs_test_feature(HUGETLB_FEATURE_SAFE_NORESERVE) <= 0) { INFO("Kernel is not safe for MAP_NORESERVE. Forcing " "use of reservations.\n"); __hugetlb_opts.no_reserve = 0; -- 1.7.1 ------------------------------------------------------------------------------ Achieve Improved Network Security with IP and DNS Reputation. Defend against bad network traffic, including botnets, malware, phishing sites, and compromised hosts - saving your company time, money, and embarrassment. Learn More! http://p.sf.net/sfu/hpdev2dev-nov _______________________________________________ Libhugetlbfs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
