diff mbox series

test_bpf: Fix NULL vs IS_ERR() check in test_skb_segment()

Message ID 20180328114836.GD29050@mwanda
State Accepted, archived
Delegated to: David Miller
Headers show
Series test_bpf: Fix NULL vs IS_ERR() check in test_skb_segment() | expand

Commit Message

Dan Carpenter March 28, 2018, 11:48 a.m. UTC
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>

Comments

Daniel Borkmann March 28, 2018, 1:25 p.m. UTC | #1
On 03/28/2018 01:48 PM, Dan Carpenter wrote:
> 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>

Patch is directly for net-next, thanks!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Yonghong Song March 28, 2018, 4:19 p.m. UTC | #2
On 3/28/18 4:48 AM, Dan Carpenter wrote:
> 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>
> 
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index b2badf6b23cd..8e157806df7a 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -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__);

Oh, my bad. Thanks for the fix!
Reviewed-by: Yonghong Song <yhs@fb.com>
Daniel Borkmann March 28, 2018, 6:57 p.m. UTC | #3
Hi David,

On 03/28/2018 06:19 PM, Yonghong Song wrote:
> On 3/28/18 4:48 AM, Dan Carpenter wrote:
>> 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>
>>
>> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
>> index b2badf6b23cd..8e157806df7a 100644
>> --- a/lib/test_bpf.c
>> +++ b/lib/test_bpf.c
>> @@ -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__);
> 
> Oh, my bad. Thanks for the fix!
> Reviewed-by: Yonghong Song <yhs@fb.com>

If you have a chance, please take this fix directly into your net-next tree
since it also contains the original commit 76db8087c4c9 ("net: bpf: add a
test for skb_segment in test_bpf module"), which is not in the bpf-next tree
at this point.

Thanks a lot,
Daniel
David Miller March 29, 2018, 6:33 p.m. UTC | #4
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Wed, 28 Mar 2018 20:57:27 +0200

> If you have a chance, please take this fix directly into your net-next tree
> since it also contains the original commit 76db8087c4c9 ("net: bpf: add a
> test for skb_segment in test_bpf module"), which is not in the bpf-next tree
> at this point.

Ok, done.
diff mbox series

Patch

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index b2badf6b23cd..8e157806df7a 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -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__);