2018-09-20 09:57:16

by zhong jiang

[permalink] [raw]
Subject: [PATCH] crypto : chtls: remove redundant null pointer check before kfree_skb

kfree_skb has taken the null pointer into account. hence it is safe
to remove the redundant null pointer check before kfree_skb.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/crypto/chelsio/chtls/chtls_cm.c | 3 +--
drivers/crypto/chelsio/chtls/chtls_main.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c
index 0997e16..fd2ae1e 100644
--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
+++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
@@ -234,8 +234,7 @@ static void chtls_send_reset(struct sock *sk, int mode, struct sk_buff *skb)

return;
out:
- if (skb)
- kfree_skb(skb);
+ kfree_skb(skb);
}

static void release_tcp_port(struct sock *sk)
diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c
index f59b044..f472c51 100644
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -272,8 +272,7 @@ static void chtls_free_uld(struct chtls_dev *cdev)
for (i = 0; i < (1 << RSPQ_HASH_BITS); i++)
kfree_skb(cdev->rspq_skb_cache[i]);
kfree(cdev->lldi);
- if (cdev->askb)
- kfree_skb(cdev->askb);
+ kfree_skb(cdev->askb);
kfree(cdev);
}

--
1.7.12.4


2018-09-28 05:09:21

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto : chtls: remove redundant null pointer check before kfree_skb

On Thu, Sep 20, 2018 at 05:57:16PM +0800, zhong jiang wrote:
> kfree_skb has taken the null pointer into account. hence it is safe
> to remove the redundant null pointer check before kfree_skb.
>
> Signed-off-by: zhong jiang <[email protected]>

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt