Skip to content

Commit 9a89394

Browse files
committed
net: tls: Avoid assigning 'const' pointer to non-const pointer
tls_build_proto() uses WRITE_ONCE() to assign a 'const' pointer to a 'non-const' pointer. Cleanups to the implementation of WRITE_ONCE() mean that this will give rise to a compiler warning, just like a plain old assignment would do: | net/tls/tls_main.c: In function ‘tls_build_proto’: | ./include/linux/compiler.h:229:30: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] | net/tls/tls_main.c:640:4: note: in expansion of macro ‘smp_store_release’ | 640 | smp_store_release(&saved_tcpv6_prot, prot); | | ^~~~~~~~~~~~~~~~~ Drop the const qualifier from the local 'prot' variable, as it isn't needed. Cc: Boris Pismenny <[email protected]> Cc: Aviad Yehezkel <[email protected]> Cc: John Fastabend <[email protected]> Cc: Daniel Borkmann <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent 514cc55 commit 9a89394

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/tls/tls_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ struct tls_context *tls_ctx_create(struct sock *sk)
629629
static void tls_build_proto(struct sock *sk)
630630
{
631631
int ip_ver = sk->sk_family == AF_INET6 ? TLSV6 : TLSV4;
632-
const struct proto *prot = READ_ONCE(sk->sk_prot);
632+
struct proto *prot = READ_ONCE(sk->sk_prot);
633633

634634
/* Build IPv6 TLS whenever the address of tcpv6 _prot changes */
635635
if (ip_ver == TLSV6 &&

0 commit comments

Comments
 (0)