All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ch_ktls: fix build warning for ipv4-only config
@ 2020-12-03 22:26 Arnd Bergmann
  2020-12-05  1:57 ` Jakub Kicinski
  2020-12-05 21:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2020-12-03 22:26 UTC (permalink / raw)
  To: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari,
	David S. Miller, Jakub Kicinski
  Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, YueHaibing,
	netdev, linux-kernel, clang-built-linux

From: Arnd Bergmann <arnd@arndb.de>

When CONFIG_IPV6 is disabled, clang complains that a variable
is uninitialized for non-IPv4 data:

drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1046:6: error: variable 'cntrl1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        if (tx_info->ip_family == AF_INET) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1059:2: note: uninitialized use occurs here
        cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
        ^~~~~~

Replace the preprocessor conditional with the corresponding C version,
and make the ipv4 case unconditional in this configuration to improve
readability and avoid the warning.

Fixes: 86716b51d14f ("ch_ktls: Update cheksum information")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c  | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
index 7f90b828d159..1b7e8c91b541 100644
--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
@@ -987,9 +987,7 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
 	struct fw_eth_tx_pkt_wr *wr;
 	struct cpl_tx_pkt_core *cpl;
 	u32 ctrl, iplen, maclen;
-#if IS_ENABLED(CONFIG_IPV6)
 	struct ipv6hdr *ip6;
-#endif
 	unsigned int ndesc;
 	struct tcphdr *tcp;
 	int len16, pktlen;
@@ -1043,17 +1041,15 @@ chcr_ktls_write_tcp_options(struct chcr_ktls_info *tx_info, struct sk_buff *skb,
 	cpl->len = htons(pktlen);
 
 	memcpy(buf, skb->data, pktlen);
-	if (tx_info->ip_family == AF_INET) {
+	if (!IS_ENABLED(CONFIG_IPV6) || tx_info->ip_family == AF_INET) {
 		/* we need to correct ip header len */
 		ip = (struct iphdr *)(buf + maclen);
 		ip->tot_len = htons(pktlen - maclen);
 		cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP);
-#if IS_ENABLED(CONFIG_IPV6)
 	} else {
 		ip6 = (struct ipv6hdr *)(buf + maclen);
 		ip6->payload_len = htons(pktlen - maclen - iplen);
 		cntrl1 = TXPKT_CSUM_TYPE_V(TX_CSUM_TCPIP6);
-#endif
 	}
 
 	cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
-- 
2.27.0


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

* Re: [PATCH] ch_ktls: fix build warning for ipv4-only config
  2020-12-03 22:26 [PATCH] ch_ktls: fix build warning for ipv4-only config Arnd Bergmann
@ 2020-12-05  1:57 ` Jakub Kicinski
  2020-12-05 23:18   ` Arnd Bergmann
  2020-12-05 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2020-12-05  1:57 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari,
	David S. Miller, Arnd Bergmann, Nathan Chancellor,
	Nick Desaulniers, YueHaibing, netdev, linux-kernel,
	clang-built-linux

On Thu,  3 Dec 2020 23:26:16 +0100 Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When CONFIG_IPV6 is disabled, clang complains that a variable
> is uninitialized for non-IPv4 data:
> 
> drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1046:6: error: variable 'cntrl1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>         if (tx_info->ip_family == AF_INET) {
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1059:2: note: uninitialized use occurs here
>         cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
>         ^~~~~~
> 
> Replace the preprocessor conditional with the corresponding C version,
> and make the ipv4 case unconditional in this configuration to improve
> readability and avoid the warning.
> 
> Fixes: 86716b51d14f ("ch_ktls: Update cheksum information")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

This is for evrey clang build or just W=1+? Would be annoying if clang
produced this on every build with 5.10 (we need to decide fix vs -next).

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

* Re: [PATCH] ch_ktls: fix build warning for ipv4-only config
  2020-12-03 22:26 [PATCH] ch_ktls: fix build warning for ipv4-only config Arnd Bergmann
  2020-12-05  1:57 ` Jakub Kicinski
@ 2020-12-05 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-05 21:00 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: ayush.sawal, vinay.yadav, rohitm, davem, kuba, arnd,
	natechancellor, ndesaulniers, yuehaibing, netdev, linux-kernel,
	clang-built-linux

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  3 Dec 2020 23:26:16 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> When CONFIG_IPV6 is disabled, clang complains that a variable
> is uninitialized for non-IPv4 data:
> 
> drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1046:6: error: variable 'cntrl1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>         if (tx_info->ip_family == AF_INET) {
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1059:2: note: uninitialized use occurs here
>         cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
>         ^~~~~~
> 
> [...]

Here is the summary with links:
  - ch_ktls: fix build warning for ipv4-only config
    https://git.kernel.org/netdev/net/c/a54ba3465d86

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH] ch_ktls: fix build warning for ipv4-only config
  2020-12-05  1:57 ` Jakub Kicinski
@ 2020-12-05 23:18   ` Arnd Bergmann
  2020-12-05 23:23     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2020-12-05 23:18 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari,
	David S. Miller, Arnd Bergmann, Nathan Chancellor,
	Nick Desaulniers, YueHaibing, Networking, linux-kernel,
	clang-built-linux

On Sat, Dec 5, 2020 at 2:57 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu,  3 Dec 2020 23:26:16 +0100 Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > When CONFIG_IPV6 is disabled, clang complains that a variable
> > is uninitialized for non-IPv4 data:
> >
> > drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1046:6: error: variable 'cntrl1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
> >         if (tx_info->ip_family == AF_INET) {
> >             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:1059:2: note: uninitialized use occurs here
> >         cntrl1 |= T6_TXPKT_ETHHDR_LEN_V(maclen - ETH_HLEN) |
> >         ^~~~~~
> >
> > Replace the preprocessor conditional with the corresponding C version,
> > and make the ipv4 case unconditional in this configuration to improve
> > readability and avoid the warning.
> >
> > Fixes: 86716b51d14f ("ch_ktls: Update cheksum information")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> This is for evrey clang build or just W=1+? Would be annoying if clang
> produced this on every build with 5.10 (we need to decide fix vs -next).

The -Wsometimes-uninitialized is enabled unconditionally for clang,
but this only happens for IPv4-only configurations with IPv6 disabled,
so most real configurations should not observe it, but the fix should still
go into v5.10.

      Arnd

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

* Re: [PATCH] ch_ktls: fix build warning for ipv4-only config
  2020-12-05 23:18   ` Arnd Bergmann
@ 2020-12-05 23:23     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2020-12-05 23:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ayush Sawal, Vinay Kumar Yadav, Rohit Maheshwari,
	David S. Miller, Arnd Bergmann, Nathan Chancellor,
	Nick Desaulniers, YueHaibing, Networking, linux-kernel,
	clang-built-linux

On Sun, 6 Dec 2020 00:18:44 +0100 Arnd Bergmann wrote:
> > This is for evrey clang build or just W=1+? Would be annoying if clang
> > produced this on every build with 5.10 (we need to decide fix vs -next).  
> 
> The -Wsometimes-uninitialized is enabled unconditionally for clang,
> but this only happens for IPv4-only configurations with IPv6 disabled,
> so most real configurations should not observe it, but the fix should still
> go into v5.10.

Great, I guessed correctly :)

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

end of thread, other threads:[~2020-12-05 23:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 22:26 [PATCH] ch_ktls: fix build warning for ipv4-only config Arnd Bergmann
2020-12-05  1:57 ` Jakub Kicinski
2020-12-05 23:18   ` Arnd Bergmann
2020-12-05 23:23     ` Jakub Kicinski
2020-12-05 21:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.