netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sfc: fix uninitialized variable use
@ 2023-06-16  9:08 Arnd Bergmann
  2023-06-16  9:08 ` [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload Arnd Bergmann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arnd Bergmann @ 2023-06-16  9:08 UTC (permalink / raw)
  To: Edward Cree, Martin Habets, Jakub Kicinski
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Simon Horman, Pieter Jansen van Vuuren, netdev, linux-net-drivers,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The new efx_bind_neigh() function contains a broken code path when IPV6 is
disabled:

drivers/net/ethernet/sfc/tc_encap_actions.c:144:7: error: variable 'n' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (encap->type & EFX_ENCAP_FLAG_IPV6) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/sfc/tc_encap_actions.c:184:8: note: uninitialized use occurs here
                if (!n) {
                     ^
drivers/net/ethernet/sfc/tc_encap_actions.c:144:3: note: remove the 'if' if its condition is always false
                if (encap->type & EFX_ENCAP_FLAG_IPV6) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/sfc/tc_encap_actions.c:141:22: note: initialize the variable 'n' to silence this warning
                struct neighbour *n;
                                   ^
                                    = NULL

Change it to use the existing error handling path here.

Fixes: 7e5e7d800011a ("sfc: neighbour lookup for TC encap action offload")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/sfc/tc_encap_actions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/sfc/tc_encap_actions.c b/drivers/net/ethernet/sfc/tc_encap_actions.c
index aac259528e73e..cfd76d5bbdd48 100644
--- a/drivers/net/ethernet/sfc/tc_encap_actions.c
+++ b/drivers/net/ethernet/sfc/tc_encap_actions.c
@@ -163,6 +163,7 @@ static int efx_bind_neigh(struct efx_nic *efx,
 			 * enabled how did someone create an IPv6 tunnel_key?
 			 */
 			rc = -EOPNOTSUPP;
+			n = NULL;
 			NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)");
 #endif
 		} else {
-- 
2.39.2


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

end of thread, other threads:[~2023-06-16 13:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16  9:08 [PATCH 1/2] sfc: fix uninitialized variable use Arnd Bergmann
2023-06-16  9:08 ` [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload Arnd Bergmann
2023-06-16 10:06   ` Simon Horman
2023-06-16 11:39   ` Edward Cree
2023-06-16 13:45     ` Thorsten Leemhuis
2023-06-16 10:06 ` [PATCH 1/2] sfc: fix uninitialized variable use Simon Horman
2023-06-16 11:29 ` Edward Cree

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).