public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net-next] xfrm: Remove unnecessary NULL check in xfrm_lookup_with_ifid()
Date: Wed, 19 Mar 2025 22:00:37 +0300	[thread overview]
Message-ID: <81d101da-45a3-4e2d-8bb9-4401efe0c44e@stanley.mountain> (raw)
In-Reply-To: <6365c171-5550-4640-92bc-0151a4de61a1@redhat.com>

On Wed, Mar 19, 2025 at 06:38:49PM +0100, Paolo Abeni wrote:
> On 3/12/25 6:21 PM, Dan Carpenter wrote:
> > This NULL check is unnecessary and can be removed.  It confuses
> > Smatch static analysis tool because it makes Smatch think that
> > xfrm_lookup_with_ifid() can return a mix of NULL pointers and errors so
> > it creates a lot of false positives.  Remove it.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > I have wanted to remove this NULL check for a long time.  Someone
> > said it could be done safely.  But please, please, review this
> > carefully.
> 
> I think it's better if this patch goes first into the ipsec/xfrm tree,
> so that hopefully it gets some serious testing before landing into net-next.
> 
> @Steffen, @Herber: could you please take this in your tree?
> 

Thanks.  The issue for me is that I've had a check which complains that
the caller doesn't check for NULL but I've expanded the check and now
there are 16 new warnings.

regards,
dan carpenter

net/mpls/af_mpls.c:633 inet6_fib_lookup_dev() warn: 'dst' can also be NULL
net/xfrm/xfrm_policy.c:2926 xfrm_policy_queue_process() warn: 'dst' can also be NULL
net/xfrm/xfrm_interface_core.c:463 xfrmi_xmit2() warn: 'dst' can also be NULL
net/core/lwt_bpf.c:242 bpf_lwt_xmit_reroute() warn: 'dst' can also be NULL
net/l2tp/l2tp_ip6.c:673 l2tp_ip6_sendmsg() warn: 'dst' can also be NULL
net/l2tp/l2tp_ip6.c:673 l2tp_ip6_sendmsg() warn: 'dst' can also be NULL
net/dccp/ipv6.c:949 dccp_v6_connect() warn: 'dst' can also be NULL
net/ipv4/ip_vti.c:223 vti_xmit() warn: 'dst' can also be NULL
net/ipv6/syncookies.c:249 cookie_v6_check() warn: 'dst' can also be NULL
net/ipv6/syncookies.c:259 cookie_v6_check() warn: 'dst' can also be NULL
net/ipv6/ip6_udp_tunnel.c:171 udp_tunnel6_dst_lookup() warn: 'dst' can also be NULL
net/ipv6/ip6_tunnel.c:1182 ip6_tnl_xmit() warn: 'dst' can also be NULL
net/ipv6/af_inet6.c:859 inet6_sk_rebuild_header() warn: 'dst' can also be NULL
net/ipv6/ip6_vti.c:489 vti6_xmit() warn: 'dst' can also be NULL
net/ipv6/ila/ila_lwt.c:92 ila_output() warn: 'dst' can also be NULL
net/ipv6/ndisc.c:510 ndisc_send_skb() warn: 'dst' can also be NULL
net/ipv6/inet6_connection_sock.c:109 inet6_csk_route_socket() warn: 'dst' can also be NULL
net/ipv6/tcp_ipv6.c:283 tcp_v6_connect() warn: 'dst' can also be NULL
net/ipv6/netfilter/nf_reject_ipv6.c:316 nf_send_reset6() warn: 'dst' can also be NULL
net/ipv6/raw.c:929 rawv6_sendmsg() warn: 'dst' can also be NULL
net/ipv6/raw.c:929 rawv6_sendmsg() warn: 'dst' can also be NULL
net/ipv6/datagram.c:114 ip6_datagram_dst_update() warn: 'dst' can also be NULL
drivers/net/vrf.c:447 vrf_process_v6_outbound() warn: 'dst' can also be NULL
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c:1156 chtls_recv_sock() warn: 'dst' can also be NULL
drivers/net/ethernet/netronome/nfp/flower/action.c:475 nfp_fl_set_tun() warn: 'dst' can also be NULL
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c:826 nfp_tunnel_request_route_v6() warn: 'dst' can also be NULL
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:464 mlx5e_route_lookup_ipv6_get() warn: 'dst' can also be NULL
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:466 mlx5e_route_lookup_ipv6_get() warn: 'dst' can also be NULL
drivers/net/wireguard/socket.c:153 send6() warn: 'dst' can also be NULL
drivers/infiniband/core/addr.c:434 addr6_resolve() warn: 'dst' can also be NULL

  reply	other threads:[~2025-03-19 19:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-12 17:21 [PATCH net-next] xfrm: Remove unnecessary NULL check in xfrm_lookup_with_ifid() Dan Carpenter
2025-03-13 13:48 ` Michal Kubiak
2025-03-19 17:38 ` Paolo Abeni
2025-03-19 19:00   ` Dan Carpenter [this message]
2025-03-20  6:33   ` Steffen Klassert
2025-03-21  2:46 ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81d101da-45a3-4e2d-8bb9-4401efe0c44e@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox