Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cecaa76b authored by Frank de Brabander's avatar Frank de Brabander Committed by David S. Miller
Browse files

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: 358be656 ("selftests/net: add txring_overwrite")
Signed-off-by: default avatarFrank de Brabander <debrabander@gmail.com>
Acked-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dd006fc4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;