public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message()
@ 2024-08-09  7:40 Roman Smirnov
  2024-08-09 20:20 ` Sergey Shtylyov
  2024-08-20 11:25 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-08-09  7:40 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Roman Smirnov, netfilter-devel, coreteam, netdev, linux-kernel,
	Sergey Shtylyov, Karina Yankevich, lvc-project

skb->dev is always non-NULL, the check is unnecessary.

Remove it.

Found by Linux Verification Center (linuxtesting.org) with Svace.

Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 net/netfilter/nfnetlink_log.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 134e05d31061..ee04a52eaf33 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -566,8 +566,7 @@ __build_packet_message(struct nfnl_log_net *log,
 	    nla_put_be32(inst->skb, NFULA_MARK, htonl(skb->mark)))
 		goto nla_put_failure;
 
-	if (indev && skb->dev &&
-	    skb_mac_header_was_set(skb) &&
+	if (indev && skb_mac_header_was_set(skb) &&
 	    skb_mac_header_len(skb) != 0) {
 		struct nfulnl_msg_packet_hw phw;
 		int len;
-- 
2.43.0


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

* Re: [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message()
  2024-08-09  7:40 [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message() Roman Smirnov
@ 2024-08-09 20:20 ` Sergey Shtylyov
  2024-08-20 11:25 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2024-08-09 20:20 UTC (permalink / raw)
  To: Roman Smirnov, Pablo Neira Ayuso, Jozsef Kadlecsik,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: netfilter-devel, coreteam, netdev, linux-kernel, Karina Yankevich,
	lvc-project

On 8/9/24 10:40 AM, Roman Smirnov wrote:

> skb->dev is always non-NULL, the check is unnecessary.
> 
> Remove it.

   Mhm, I don't think we need that in a separate paragraph...

> Found by Linux Verification Center (linuxtesting.org) with Svace.
> 
> Signed-off-by: Roman Smirnov <r.smirnov@omp.ru>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
[...]

MBR, Sergey

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

* Re: [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message()
  2024-08-09  7:40 [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message() Roman Smirnov
  2024-08-09 20:20 ` Sergey Shtylyov
@ 2024-08-20 11:25 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2024-08-20 11:25 UTC (permalink / raw)
  To: Roman Smirnov
  Cc: Jozsef Kadlecsik, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, netfilter-devel, coreteam, netdev, linux-kernel,
	Sergey Shtylyov, Karina Yankevich, lvc-project

On Fri, Aug 09, 2024 at 10:40:35AM +0300, Roman Smirnov wrote:
> skb->dev is always non-NULL, the check is unnecessary.

Same check exists in nfnetlink_queue, these two codebases have many
similarities.

I cannot think of any scenario where skb->dev is NULL in any of the
existing hooks.

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

end of thread, other threads:[~2024-08-20 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  7:40 [PATCH] netfilter: nfnetlink_log: remove unnecessary check in __build_packet_message() Roman Smirnov
2024-08-09 20:20 ` Sergey Shtylyov
2024-08-20 11:25 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox