diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-09-20 17:37:41 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-21 09:04:37 -0700 |
commit | 144a6adfa1435e6235fd55b700d2c9f93345bb7f (patch) | |
tree | 040b2817394f6704e9c2c2f0a3b6fbcbcd9c370c /drivers/net/tap.c | |
parent | 68c385079cb3530f03e22e563885e6ddaa11a586 (diff) |
net: tap: 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 <zhongjiang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tap.c')
-rw-r--r-- | drivers/net/tap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/tap.c b/drivers/net/tap.c index a4ab4a791fe7..f03004f37eca 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c @@ -830,8 +830,7 @@ static ssize_t tap_do_read(struct tap_queue *q, ssize_t ret = 0; if (!iov_iter_count(to)) { - if (skb) - kfree_skb(skb); + kfree_skb(skb); return 0; } @@ -1236,8 +1235,7 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m, struct sk_buff *skb = m->msg_control; int ret; if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) { - if (skb) - kfree_skb(skb); + kfree_skb(skb); return -EINVAL; } ret = tap_do_read(q, &m->msg_iter, flags & MSG_DONTWAIT, skb); |