summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank de Brabander <debrabander@gmail.com>2019-07-05 13:43:14 +0200
committerDavid S. Miller <davem@davemloft.net>2019-07-08 15:39:38 -0700
commitcecaa76b2919aac2aa584ce476e9fcd5b084add5 (patch)
treef354192e6a05bbb592e444771cfd159c823512a3
parentdd006fc434e107ef90f7de0db9907cbc1c521645 (diff)
downloadlinux-stable-cecaa76b2919aac2aa584ce476e9fcd5b084add5.tar.gz
linux-stable-cecaa76b2919aac2aa584ce476e9fcd5b084add5.tar.bz2
linux-stable-cecaa76b2919aac2aa584ce476e9fcd5b084add5.zip
selftests: txring_overwrite: fix incorrect test of mmap() return value
If mmap() fails it returns MAP_FAILED, which is defined as ((void *) -1). The current if-statement incorrectly tests if *ring is NULL. Fixes: 358be656406d ("selftests/net: add txring_overwrite") Signed-off-by: Frank de Brabander <debrabander@gmail.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/testing/selftests/net/txring_overwrite.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/net/txring_overwrite.c b/tools/testing/selftests/net/txring_overwrite.c
index fd8b1c663c39..7d9ea039450a 100644
--- a/tools/testing/selftests/net/txring_overwrite.c
+++ b/tools/testing/selftests/net/txring_overwrite.c
@@ -113,7 +113,7 @@ static int setup_tx(char **ring)
*ring = mmap(0, req.tp_block_size * req.tp_block_nr,
PROT_READ | PROT_WRITE, MAP_SHARED, fdt, 0);
- if (!*ring)
+ if (*ring == MAP_FAILED)
error(1, errno, "mmap");
return fdt;