Skip to content

Commit f61d2d5

Browse files
arndbkuba-moo
authored andcommitted
sfc: fix uninitialized variable use
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: 7e5e7d8 ("sfc: neighbour lookup for TC encap action offload") Suggested-by: Edward Cree <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Edward Cree <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 40cba83 commit f61d2d5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/sfc/tc_encap_actions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static int efx_bind_neigh(struct efx_nic *efx,
164164
*/
165165
rc = -EOPNOTSUPP;
166166
NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)");
167+
goto out_free;
167168
#endif
168169
} else {
169170
rt = ip_route_output_key(net, &flow4);

0 commit comments

Comments
 (0)