mem: fix comparison of old policy
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 16 Apr 2018 16:18:55 +0000 (17:18 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:42:40 +0000 (23:42 +0200)
Previous code had an old rebase leftover from the time when
oldpolicy was an actual int, instead of a pointer. Fix it to
do comparison with dereferencing the pointer.

Coverity issue: 272589
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/linuxapp/eal/eal_memalloc.c

index 6f0eda5..174b1b7 100644 (file)
@@ -146,7 +146,7 @@ resotre_numa(int *oldpolicy, struct bitmask *oldmask)
 {
        RTE_LOG(DEBUG, EAL,
                "Restoring previous memory policy: %d\n", *oldpolicy);
-       if (oldpolicy == MPOL_DEFAULT) {
+       if (*oldpolicy == MPOL_DEFAULT) {
                numa_set_localalloc();
        } else if (set_mempolicy(*oldpolicy, oldmask->maskp,
                                 oldmask->size + 1) < 0) {