[B][PATCH 3/3] test_bpf: Fix NULL vs IS_ERR() check in test_skb_segment()

Guilherme G. Piccoli gpiccoli at canonical.com
Fri Feb 12 20:41:59 UTC 2021


From: Dan Carpenter <dan.carpenter at oracle.com>

BugLink: https://bugs.launchpad.net/bugs/1915552

The skb_segment() function returns error pointers on error.  It never
returns NULL.

Fixes: 76db8087c4c9 ("net: bpf: add a test for skb_segment in test_bpf module")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Acked-by: Daniel Borkmann <daniel at iogearbox.net>
Reviewed-by: Yonghong Song <yhs at fb.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 99fe29d3a25f813146816b322367b4c6a0fdec84)
Signed-off-by: Guilherme G. Piccoli <gpiccoli at canonical.com>
---
 lib/test_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 3f0821cb0ab4..9f5530b8a2f8 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -6557,7 +6557,7 @@ static __init int test_skb_segment(void)
 	}
 
 	segs = skb_segment(skb, features);
-	if (segs) {
+	if (!IS_ERR(segs)) {
 		kfree_skb_list(segs);
 		ret = 0;
 		pr_info("%s: success in skb_segment!", __func__);
-- 
2.29.0




More information about the kernel-team mailing list