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

* [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload
  2023-06-16  9:08 [PATCH 1/2] sfc: fix uninitialized variable use Arnd Bergmann
@ 2023-06-16  9:08 ` Arnd Bergmann
  2023-06-16 10:06   ` Simon Horman
  2023-06-16 11:39   ` Edward Cree
  2023-06-16 10:06 ` [PATCH 1/2] sfc: fix uninitialized variable use Simon Horman
  2023-06-16 11:29 ` Edward Cree
  2 siblings, 2 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,
	Alejandro Lucero, Jiri Pirko, Pieter Jansen van Vuuren,
	Simon Horman, netdev, linux-net-drivers, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The driver now fails to link when CONFIG_INET is disabled, so
add an explicit Kconfig dependency:

ld.lld: error: undefined symbol: ip_route_output_flow
>>> referenced by tc_encap_actions.c
>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_flower_create_encap_md) in archive vmlinux.a

ld.lld: error: undefined symbol: ip_send_check
>>> referenced by tc_encap_actions.c
>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a
>>> referenced by tc_encap_actions.c
>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a

ld.lld: error: undefined symbol: arp_tbl
>>> referenced by tc_encap_actions.c
>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a
>>> referenced by tc_encap_actions.c
>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a

Fixes: a1e82162af0b8 ("sfc: generate encap headers for TC offload")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/sfc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
index 4af36ba8906ba..3eb55dcfa8a61 100644
--- a/drivers/net/ethernet/sfc/Kconfig
+++ b/drivers/net/ethernet/sfc/Kconfig
@@ -50,6 +50,7 @@ config SFC_MCDI_MON
 config SFC_SRIOV
 	bool "Solarflare SFC9100-family SR-IOV support"
 	depends on SFC && PCI_IOV
+	depends on INET
 	default y
 	help
 	  This enables support for the Single Root I/O Virtualization
-- 
2.39.2


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

* Re: [PATCH 1/2] sfc: fix uninitialized variable use
  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:29 ` Edward Cree
  2 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-06-16 10:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Edward Cree, Martin Habets, Jakub Kicinski, Arnd Bergmann,
	David S. Miller, Eric Dumazet, Paolo Abeni,
	Pieter Jansen van Vuuren, netdev, linux-net-drivers, linux-kernel

On Fri, Jun 16, 2023 at 11:08:18AM +0200, Arnd Bergmann wrote:
> 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>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


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

* Re: [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload
  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
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-06-16 10:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Edward Cree, Martin Habets, Jakub Kicinski, Arnd Bergmann,
	David S. Miller, Eric Dumazet, Paolo Abeni, Alejandro Lucero,
	Jiri Pirko, Pieter Jansen van Vuuren, netdev, linux-net-drivers,
	linux-kernel

On Fri, Jun 16, 2023 at 11:08:19AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The driver now fails to link when CONFIG_INET is disabled, so
> add an explicit Kconfig dependency:
> 
> ld.lld: error: undefined symbol: ip_route_output_flow
> >>> referenced by tc_encap_actions.c
> >>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_flower_create_encap_md) in archive vmlinux.a
> 
> ld.lld: error: undefined symbol: ip_send_check
> >>> referenced by tc_encap_actions.c
> >>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a
> >>> referenced by tc_encap_actions.c
> >>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a
> 
> ld.lld: error: undefined symbol: arp_tbl
> >>> referenced by tc_encap_actions.c
> >>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a
> >>> referenced by tc_encap_actions.c
> >>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a
> 
> Fixes: a1e82162af0b8 ("sfc: generate encap headers for TC offload")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


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

* Re: [PATCH 1/2] sfc: fix uninitialized variable use
  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 ` [PATCH 1/2] sfc: fix uninitialized variable use Simon Horman
@ 2023-06-16 11:29 ` Edward Cree
  2 siblings, 0 replies; 7+ messages in thread
From: Edward Cree @ 2023-06-16 11:29 UTC (permalink / raw)
  To: Arnd Bergmann, 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

On 16/06/2023 10:08, Arnd Bergmann wrote:
> 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 {
> 

Nack.  There is a bug here, as you've identified, but the right fix
 is to add a 'goto out_free;' after setting the rc and extack msg.
Setting n to NULL and relying on the subsequent error path will not
 only produce the wrong rc and error message, it will also attempt
 to drop a reference on neigh->egdev that was never taken.

-ed

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

* Re: [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload
  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
  1 sibling, 1 reply; 7+ messages in thread
From: Edward Cree @ 2023-06-16 11:39 UTC (permalink / raw)
  To: Arnd Bergmann, Martin Habets, Jakub Kicinski
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Alejandro Lucero, Jiri Pirko, Pieter Jansen van Vuuren,
	Simon Horman, netdev, linux-net-drivers, linux-kernel

On 16/06/2023 10:08, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The driver now fails to link when CONFIG_INET is disabled, so
> add an explicit Kconfig dependency:
> 
> ld.lld: error: undefined symbol: ip_route_output_flow
>>>> referenced by tc_encap_actions.c
>>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_flower_create_encap_md) in archive vmlinux.a
> 
> ld.lld: error: undefined symbol: ip_send_check
>>>> referenced by tc_encap_actions.c
>>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a
>>>> referenced by tc_encap_actions.c
>>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_gen_encap_header) in archive vmlinux.a
> 
> ld.lld: error: undefined symbol: arp_tbl
>>>> referenced by tc_encap_actions.c
>>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a
>>>> referenced by tc_encap_actions.c
>>>>               drivers/net/ethernet/sfc/tc_encap_actions.o:(efx_tc_netevent_event) in archive vmlinux.a
> 
> Fixes: a1e82162af0b8 ("sfc: generate encap headers for TC offload")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
 and I think you also need
Fixes: 7e5e7d800011 ("sfc: neighbour lookup for TC encap action offload")
 since that added the references to ip_route_output_flow and arp_tbl (the
 commit in your Fixes: added the ip_send_check reference on top of that).

You also might want to add the Closes: tag from [1], I don't know how
 that works but I assume it'll make someone's regression-bot happy.

-ed

[1] https://lore.kernel.org/oe-kbuild-all/202306151656.yttECVTP-lkp@intel.com/

> ---
>  drivers/net/ethernet/sfc/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/sfc/Kconfig b/drivers/net/ethernet/sfc/Kconfig
> index 4af36ba8906ba..3eb55dcfa8a61 100644
> --- a/drivers/net/ethernet/sfc/Kconfig
> +++ b/drivers/net/ethernet/sfc/Kconfig
> @@ -50,6 +50,7 @@ config SFC_MCDI_MON
>  config SFC_SRIOV
>  	bool "Solarflare SFC9100-family SR-IOV support"
>  	depends on SFC && PCI_IOV
> +	depends on INET
>  	default y
>  	help
>  	  This enables support for the Single Root I/O Virtualization
> 


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

* Re: [PATCH 2/2] sfc: add CONFIG_INET dependency for TC offload
  2023-06-16 11:39   ` Edward Cree
@ 2023-06-16 13:45     ` Thorsten Leemhuis
  0 siblings, 0 replies; 7+ messages in thread
From: Thorsten Leemhuis @ 2023-06-16 13:45 UTC (permalink / raw)
  To: Edward Cree, Arnd Bergmann, Martin Habets, Jakub Kicinski
  Cc: Arnd Bergmann, David S. Miller, Eric Dumazet, Paolo Abeni,
	Alejandro Lucero, Jiri Pirko, Pieter Jansen van Vuuren,
	Simon Horman, netdev, linux-net-drivers, linux-kernel

On 16.06.23 13:39, Edward Cree wrote:
> On 16/06/2023 10:08, Arnd Bergmann wrote:
>>
>> Fixes: a1e82162af0b8 ("sfc: generate encap headers for TC offload")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> Reviewed-by: Edward Cree <ecree.xilinx@gmail.com>
>  and I think you also need
> Fixes: 7e5e7d800011 ("sfc: neighbour lookup for TC encap action offload")
>  since that added the references to ip_route_output_flow and arp_tbl (the
>  commit in your Fixes: added the ip_send_check reference on top of that).
> 
> You also might want to add the Closes: tag from [1], I don't know how
>  that works but I assume it'll make someone's regression-bot happy.
>
> [1] https://lore.kernel.org/oe-kbuild-all/202306151656.yttECVTP-lkp@intel.com/

FWIW, yes, regression tracking relies on them (for now Link: and the
newly introduced Closes: work; the latter came up totally independent of
regression tracking). And I have no problem with being the bad guy here. :-D

But for completeness, in case anyone cares:

It's Linus that for many years already wants these links. He a while ago
mentioned that in a few posts I bookmarked:

https://lore.kernel.org/all/CAHk-=wjMmSZzMJ3Xnskdg4+GGz=5p5p+GSYyFBTh0f-DgvdBWg@mail.gmail.com/
https://lore.kernel.org/all/CAHk-=wgs38ZrfPvy=nOwVkVzjpM3VFU1zobP37Fwd_h9iAD5JQ@mail.gmail.com/
https://lore.kernel.org/all/CAHk-=wjxzafG-=J8oT30s7upn4RhBs6TX-uVFZ5rME+L5_DoJA@mail.gmail.com/

But that's nothing new: Documentation/process/submitting-patches.rst
explained this usage for many years already (I just made this more
explicit a while a go).

Ciao, Thorsten

^ permalink raw reply	[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).