* [PATCH] net/tls: fix const assignment warning
@ 2020-04-08 18:54 Arnd Bergmann
2020-04-08 18:59 ` Boris Pismenny
2020-04-08 21:34 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-04-08 18:54 UTC (permalink / raw)
To: Boris Pismenny, Aviad Yehezkel, John Fastabend, Daniel Borkmann,
Jakub Kicinski, David S. Miller, Jakub Sitnicki
Cc: Arnd Bergmann, Dirk van der Merwe, Simon Horman, Davide Caratti,
netdev, linux-kernel
Building with some experimental patches, I came across a warning
in the tls code:
include/linux/compiler.h:215:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
215 | *(volatile typeof(x) *)&(x) = (val); \
| ^
net/tls/tls_main.c:650:4: note: in expansion of macro 'smp_store_release'
650 | smp_store_release(&saved_tcpv4_prot, prot);
This appears to be a legitimate warning about assigning a const pointer
into the non-const 'saved_tcpv4_prot' global. Annotate both the ipv4 and
ipv6 pointers 'const' to make the code internally consistent.
Fixes: 5bb4c45d466c ("net/tls: Read sk_prot once when building tls proto ops")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
net/tls/tls_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 156efce50dbd..0e989005bdc2 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -56,9 +56,9 @@ enum {
TLS_NUM_PROTS,
};
-static struct proto *saved_tcpv6_prot;
+static const struct proto *saved_tcpv6_prot;
static DEFINE_MUTEX(tcpv6_prot_mutex);
-static struct proto *saved_tcpv4_prot;
+static const struct proto *saved_tcpv4_prot;
static DEFINE_MUTEX(tcpv4_prot_mutex);
static struct proto tls_prots[TLS_NUM_PROTS][TLS_NUM_CONFIG][TLS_NUM_CONFIG];
static struct proto_ops tls_sw_proto_ops;
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/tls: fix const assignment warning
2020-04-08 18:54 [PATCH] net/tls: fix const assignment warning Arnd Bergmann
@ 2020-04-08 18:59 ` Boris Pismenny
2020-04-08 21:34 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Boris Pismenny @ 2020-04-08 18:59 UTC (permalink / raw)
To: Arnd Bergmann, Aviad Yehezkel, John Fastabend, Daniel Borkmann,
Jakub Kicinski, David S. Miller, Jakub Sitnicki
Cc: Dirk van der Merwe, Simon Horman, Davide Caratti, netdev, linux-kernel
On 08/04/2020 21:54, Arnd Bergmann wrote:
> Building with some experimental patches, I came across a warning
> in the tls code:
>
> include/linux/compiler.h:215:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 215 | *(volatile typeof(x) *)&(x) = (val); \
> | ^
> net/tls/tls_main.c:650:4: note: in expansion of macro 'smp_store_release'
> 650 | smp_store_release(&saved_tcpv4_prot, prot);
>
> This appears to be a legitimate warning about assigning a const pointer
> into the non-const 'saved_tcpv4_prot' global. Annotate both the ipv4 and
> ipv6 pointers 'const' to make the code internally consistent.
>
> Fixes: 5bb4c45d466c ("net/tls: Read sk_prot once when building tls proto ops")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/tls/tls_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
> index 156efce50dbd..0e989005bdc2 100644
> --- a/net/tls/tls_main.c
> +++ b/net/tls/tls_main.c
> @@ -56,9 +56,9 @@ enum {
> TLS_NUM_PROTS,
> };
>
> -static struct proto *saved_tcpv6_prot;
> +static const struct proto *saved_tcpv6_prot;
> static DEFINE_MUTEX(tcpv6_prot_mutex);
> -static struct proto *saved_tcpv4_prot;
> +static const struct proto *saved_tcpv4_prot;
> static DEFINE_MUTEX(tcpv4_prot_mutex);
> static struct proto tls_prots[TLS_NUM_PROTS][TLS_NUM_CONFIG][TLS_NUM_CONFIG];
> static struct proto_ops tls_sw_proto_ops;
>
LGTM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/tls: fix const assignment warning
2020-04-08 18:54 [PATCH] net/tls: fix const assignment warning Arnd Bergmann
2020-04-08 18:59 ` Boris Pismenny
@ 2020-04-08 21:34 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-04-08 21:34 UTC (permalink / raw)
To: arnd
Cc: borisp, aviadye, john.fastabend, daniel, kuba, jakub,
dirk.vandermerwe, simon.horman, dcaratti, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Wed, 8 Apr 2020 20:54:43 +0200
> Building with some experimental patches, I came across a warning
> in the tls code:
>
> include/linux/compiler.h:215:30: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 215 | *(volatile typeof(x) *)&(x) = (val); \
> | ^
> net/tls/tls_main.c:650:4: note: in expansion of macro 'smp_store_release'
> 650 | smp_store_release(&saved_tcpv4_prot, prot);
>
> This appears to be a legitimate warning about assigning a const pointer
> into the non-const 'saved_tcpv4_prot' global. Annotate both the ipv4 and
> ipv6 pointers 'const' to make the code internally consistent.
>
> Fixes: 5bb4c45d466c ("net/tls: Read sk_prot once when building tls proto ops")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-08 21:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-08 18:54 [PATCH] net/tls: fix const assignment warning Arnd Bergmann
2020-04-08 18:59 ` Boris Pismenny
2020-04-08 21:34 ` David Miller
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).