* [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value
@ 2019-07-05 11:43 Frank de Brabander
2019-07-05 19:55 ` Willem de Bruijn
2019-07-08 22:40 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Frank de Brabander @ 2019-07-05 11:43 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Frank de Brabander
If mmap() fails it returns MAP_FAILED, which is defined as ((void *) -1).
The current if-statement incorrectly tests if *ring is NULL.
Signed-off-by: Frank de Brabander <debrabander@gmail.com>
---
tools/testing/selftests/net/txring_overwrite.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/txring_overwrite.c b/tools/testing/selftests/net/txring_overwrite.c
index fd8b1c6..7d9ea03 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;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value
2019-07-05 11:43 [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value Frank de Brabander
@ 2019-07-05 19:55 ` Willem de Bruijn
2019-07-08 22:40 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2019-07-05 19:55 UTC (permalink / raw)
To: Frank de Brabander; +Cc: David S . Miller, Network Development
On Fri, Jul 5, 2019 at 7:44 AM Frank de Brabander <debrabander@gmail.com> wrote:
>
> If mmap() fails it returns MAP_FAILED, which is defined as ((void *) -1).
> The current if-statement incorrectly tests if *ring is NULL.
>
> Signed-off-by: Frank de Brabander <debrabander@gmail.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Fixes: 358be656406d ("selftests/net: add txring_overwrite")
Thanks Frank. Please mark future networking patches as [PATCH net] or
[PATCH net-next].
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value
2019-07-05 11:43 [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value Frank de Brabander
2019-07-05 19:55 ` Willem de Bruijn
@ 2019-07-08 22:40 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-07-08 22:40 UTC (permalink / raw)
To: debrabander; +Cc: netdev
From: Frank de Brabander <debrabander@gmail.com>
Date: Fri, 5 Jul 2019 13:43:14 +0200
> If mmap() fails it returns MAP_FAILED, which is defined as ((void *) -1).
> The current if-statement incorrectly tests if *ring is NULL.
>
> Signed-off-by: Frank de Brabander <debrabander@gmail.com>
Applied with fixes tag added and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-08 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 11:43 [PATCH] selftests: txring_overwrite: fix incorrect test of mmap() return value Frank de Brabander
2019-07-05 19:55 ` Willem de Bruijn
2019-07-08 22:40 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).