From: Edward Cree <ecree.xilinx@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>,
Martin Habets <habetsm.xilinx@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Pieter Jansen van Vuuren <pieter.jansen-van-vuuren@amd.com>,
Simon Horman <simon.horman@corigine.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
netdev@vger.kernel.org, linux-net-drivers@amd.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] [v2] sfc: fix uninitialized variable use
Date: Mon, 19 Jun 2023 11:06:54 +0100 [thread overview]
Message-ID: <01bad0cf-f67c-3357-d373-cd2b46e26a90@gmail.com> (raw)
In-Reply-To: <20230619091215.2731541-2-arnd@kernel.org>
On 19/06/2023 10:12, 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")
> Suggested-by: Edward Cree <ecree.xilinx@gmail.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Edward Cree <ecree.xilinx@gmail.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);
>
next prev parent reply other threads:[~2023-06-19 10:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 9:12 [PATCH 1/3] [v2] sfc: add CONFIG_INET dependency for TC offload Arnd Bergmann
2023-06-19 9:12 ` [PATCH 2/3] [v2] sfc: fix uninitialized variable use Arnd Bergmann
2023-06-19 10:06 ` Edward Cree [this message]
2023-06-19 9:12 ` [PATCH 3/3] sfc: selftest: fix struct packing Arnd Bergmann
2023-06-19 10:25 ` Edward Cree
2023-06-19 13:04 ` Arnd Bergmann
2023-06-19 14:55 ` Arnd Bergmann
2023-06-23 10:52 ` David Laight
2023-06-23 12:57 ` Edward Cree
2023-06-19 10:04 ` [PATCH 1/3] [v2] sfc: add CONFIG_INET dependency for TC offload Edward Cree
2023-06-21 3:40 ` patchwork-bot+netdevbpf
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=01bad0cf-f67c-3357-d373-cd2b46e26a90@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=habetsm.xilinx@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pieter.jansen-van-vuuren@amd.com \
--cc=simon.horman@corigine.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;
as well as URLs for NNTP newsgroup(s).