selftests: txring_overwrite: fix incorrect test of mmap() return value
Subsystems (3)
PATCH 1/1 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.
Signed-off-by Frank de Brabander <[email protected]>
--- tools/testing/selftests/net/txring_overwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/txring_overwrite.c +1 -1
@@ -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;
Signature · 1 line
2.7.4
Quoted 5 lines · Frank de Brabander
If
mmap()fails it returnsMAP_FAILED, which is defined as ((void *) -1). The current if-statement incorrectly tests if *ring is NULL.Signed-off-by Frank de Brabander <[email protected]>
Acked-by Willem de Bruijn <[email protected]>
Fixes 358be656406d ("selftests/net: add txring_overwrite")
Thanks Frank. Please mark future networking patches as [PATCH net] or [PATCH net-next].
David Miller
maintainerFrom: Frank de Brabander <[email protected]>
Date: Fri, 5 Jul 2019 13:43:14 +0200
Quoted 4 lines
If
mmap()fails it returnsMAP_FAILED, which is defined as ((void *) -1). The current if-statement incorrectly tests if *ring is NULL.Signed-off-by Frank de Brabander <[email protected]>
Applied with fixes tag added and queued up for -stable, thanks.