]> git.baikalelectronics.ru Git - kernel.git/commit
net: tls: Avoid assigning 'const' pointer to non-const pointer
authorWill Deacon <will@kernel.org>
Tue, 14 Apr 2020 22:13:50 +0000 (23:13 +0100)
committerWill Deacon <will@kernel.org>
Wed, 15 Apr 2020 20:36:41 +0000 (21:36 +0100)
commit46b1cb0def96cc0b421e5ea2b098ff35c690d5a4
tree74e920bbc7758663af84c675fbc9a000efd46a4e
parentff8bfe95812608fc7038790935855bef59ef57d4
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 <borisp@mellanox.com>
Cc: Aviad Yehezkel <aviadye@mellanox.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Will Deacon <will@kernel.org>
net/tls/tls_main.c