diff mbox series

[2/4] RDMA/rxe: Don't check for NULL before calling kfree_skb()

Message ID 20181030135427.19036-3-andrew.boyer@dell.com (mailing list archive)
State Superseded
Headers show
Series RDMA/rxe: skb handling, link state, statistics | expand

Commit Message

Andrew Boyer Oct. 30, 2018, 1:54 p.m. UTC
kfree_skb() already handles the case in which skb is NULL.

Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
---
 drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Majd Dibbiny Oct. 30, 2018, 6:38 p.m. UTC | #1
> On Oct 30, 2018, at 4:03 PM, Andrew Boyer <andrew.boyer@dell.com> wrote:
> 
> kfree_skb() already handles the case in which skb is NULL.
> 
> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> ---
> drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
> index 08ad9dc72205..26e82f5fb4cb 100644
> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
> @@ -328,8 +328,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
>    rxe_drop_ref(mcg);    /* drop ref from rxe_pool_get_key. */
> 
> err1:
> -    if (skb)
> -        kfree_skb(skb);
> +    kfree_skb(skb);
> }
> 
> static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
> -- 
> 2.16.2
>
Zhu Yanjun Oct. 30, 2018, 10:34 p.m. UTC | #2
On 2018/10/30 21:54, Andrew Boyer wrote:
> kfree_skb() already handles the case in which skb is NULL.
>
> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>

Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>

> ---
>   drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
> index 08ad9dc72205..26e82f5fb4cb 100644
> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
> @@ -328,8 +328,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
>   	rxe_drop_ref(mcg);	/* drop ref from rxe_pool_get_key. */
>   
>   err1:
> -	if (skb)
> -		kfree_skb(skb);
> +	kfree_skb(skb);
>   }
>   
>   static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
Zhu Yanjun Oct. 30, 2018, 11:05 p.m. UTC | #3
On 2018/10/31 6:34, Yanjun Zhu wrote:
>
>
> On 2018/10/30 21:54, Andrew Boyer wrote:
>> kfree_skb() already handles the case in which skb is NULL.
>>
>> Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
>
> Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Sorry. My bad. I think this is also fixed in the latest linux kernel.
Please check it again.

Zhu Yanjun
>
>> ---
>>   drivers/infiniband/sw/rxe/rxe_recv.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c 
>> b/drivers/infiniband/sw/rxe/rxe_recv.c
>> index 08ad9dc72205..26e82f5fb4cb 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_recv.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
>> @@ -328,8 +328,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev 
>> *rxe, struct sk_buff *skb)
>>       rxe_drop_ref(mcg);    /* drop ref from rxe_pool_get_key. */
>>     err1:
>> -    if (skb)
>> -        kfree_skb(skb);
>> +    kfree_skb(skb);
>>   }
>>     static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)
>
>
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
index 08ad9dc72205..26e82f5fb4cb 100644
--- a/drivers/infiniband/sw/rxe/rxe_recv.c
+++ b/drivers/infiniband/sw/rxe/rxe_recv.c
@@ -328,8 +328,7 @@  static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)
 	rxe_drop_ref(mcg);	/* drop ref from rxe_pool_get_key. */
 
 err1:
-	if (skb)
-		kfree_skb(skb);
+	kfree_skb(skb);
 }
 
 static int rxe_match_dgid(struct rxe_dev *rxe, struct sk_buff *skb)