test_bpf: Fix NULL vs IS_ERR() check in test_skb_segment()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 28 Mar 2018 11:48:36 +0000 (14:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Mar 2018 18:33:29 +0000 (14:33 -0400)
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@oracle.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/test_bpf.c

index b2badf6b23cdb10e27b6575806304dd0524755c9..8e157806df7a6d78fed7afc63787d8517fbcc976 100644 (file)
@@ -6649,7 +6649,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__);