[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01bad0cf-f67c-3357-d373-cd2b46e26a90@gmail.com>
Date: Mon, 19 Jun 2023 11:06:54 +0100
From: Edward Cree <ecree.xilinx@...il.com>
To: Arnd Bergmann <arnd@...nel.org>, Martin Habets
<habetsm.xilinx@...il.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@....com>,
Simon Horman <simon.horman@...igine.com>
Cc: Arnd Bergmann <arnd@...db.de>, netdev@...r.kernel.org,
linux-net-drivers@....com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/3] [v2] sfc: fix uninitialized variable use
On 19/06/2023 10:12, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.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")
> Suggested-by: Edward Cree <ecree.xilinx@...il.com>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
Reviewed-by: Edward Cree <ecree.xilinx@...il.com>
> ---
> v2: use 'goto' instead of incorrectly entering another error path
> ---
> 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..7e8bcdb222ad1 100644
> --- a/drivers/net/ethernet/sfc/tc_encap_actions.c
> +++ b/drivers/net/ethernet/sfc/tc_encap_actions.c
> @@ -164,6 +164,7 @@ static int efx_bind_neigh(struct efx_nic *efx,
> */
> rc = -EOPNOTSUPP;
> NL_SET_ERR_MSG_MOD(extack, "No IPv6 support (neigh bind)");
> + goto out_free;
> #endif
> } else {
> rt = ip_route_output_key(net, &flow4);
>
Powered by blists - more mailing lists