Skip to content

Commit 144a6ad

Browse files
xiongzhongjiangdavem330
authored andcommitted
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>
1 parent 68c3850 commit 144a6ad

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎drivers/net/tap.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,7 @@ static ssize_t tap_do_read(struct tap_queue *q,
830830
ssize_t ret = 0;
831831

832832
if (!iov_iter_count(to)) {
833-
if (skb)
834-
kfree_skb(skb);
833+
kfree_skb(skb);
835834
return 0;
836835
}
837836

@@ -1236,8 +1235,7 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m,
12361235
struct sk_buff *skb = m->msg_control;
12371236
int ret;
12381237
if (flags & ~(MSG_DONTWAIT|MSG_TRUNC)) {
1239-
if (skb)
1240-
kfree_skb(skb);
1238+
kfree_skb(skb);
12411239
return -EINVAL;
12421240
}
12431241
ret = tap_do_read(q, &m->msg_iter, flags & MSG_DONTWAIT, skb);

0 commit comments

Comments
 (0)