Skip to content

Commit 788758d

Browse files
xiongzhongjiangborkmann
authored andcommitted
bpf: remove redundant null pointer check before consume_skb
consume_skb has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before consume_skb. Signed-off-by: zhong jiang <[email protected]> Acked-by: Song Liu <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 32c0097 commit 788758d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kernel/bpf/sockmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ static int free_sg(struct sock *sk, int start,
590590
if (i == MAX_SKB_FRAGS)
591591
i = 0;
592592
}
593-
if (md->skb)
594-
consume_skb(md->skb);
593+
consume_skb(md->skb);
595594

596595
return free;
597596
}
@@ -973,8 +972,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
973972

974973
if (!sg->length && md->sg_start == md->sg_end) {
975974
list_del(&md->list);
976-
if (md->skb)
977-
consume_skb(md->skb);
975+
consume_skb(md->skb);
978976
kfree(md);
979977
}
980978
}

0 commit comments

Comments
 (0)