bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/core/skmsg: Delete an unnecessary check before the function call “consume_skb”
@ 2019-08-22 16:08 Markus Elfring
  2019-08-22 21:13 ` Song Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-08-22 16:08 UTC (permalink / raw)
  To: netdev, bpf, Daniel Borkmann, David S. Miller, John Fastabend
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 22 Aug 2019 18:00:40 +0200

The consume_skb() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 net/core/skmsg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/core/skmsg.c b/net/core/skmsg.c
index 6832eeb4b785..cf390e0aa73d 100644
--- a/net/core/skmsg.c
+++ b/net/core/skmsg.c
@@ -190,8 +190,7 @@ static int __sk_msg_free(struct sock *sk, struct sk_msg *msg, u32 i,
 		sk_msg_check_to_free(msg, i, msg->sg.size);
 		sge = sk_msg_elem(msg, i);
 	}
-	if (msg->skb)
-		consume_skb(msg->skb);
+	consume_skb(msg->skb);
 	sk_msg_init(msg);
 	return freed;
 }
--
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/core/skmsg: Delete an unnecessary check before the function call “consume_skb”
  2019-08-22 16:08 [PATCH] net/core/skmsg: Delete an unnecessary check before the function call “consume_skb” Markus Elfring
@ 2019-08-22 21:13 ` Song Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2019-08-22 21:13 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Networking, bpf, Daniel Borkmann, David S. Miller,
	John Fastabend, LKML, kernel-janitors

On Thu, Aug 22, 2019 at 10:18 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 22 Aug 2019 18:00:40 +0200
>
> The consume_skb() function performs also input parameter validation.
> Thus the test around the call is not needed.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Song Liu <songliubraving@fb.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-22 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 16:08 [PATCH] net/core/skmsg: Delete an unnecessary check before the function call “consume_skb” Markus Elfring
2019-08-22 21:13 ` Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).