wifi: ath: Silence memcpy run-time false positive warning
authorKees Cook <keescook@chromium.org>
Wed, 15 Feb 2023 18:31:38 +0000 (20:31 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Fri, 17 Feb 2023 16:24:16 +0000 (18:24 +0200)
commitbfcc8ba45eb87bfaaff900bbad2b87b204899d41
tree55fc97e1efdfb1184bb0d27f553cc20a4e03d02a
parent3c3ab8c9a29662ef25f8f62b8f118cd9b0eadd88
wifi: ath: Silence memcpy run-time false positive warning

The memcpy() in ath_key_config() was attempting to write across
neighboring struct members in struct ath_keyval. Introduce a wrapping
struct_group, kv_values, to be the addressable target of the memcpy
without overflowing an individual member. Silences the false positive
run-time warning:

  memcpy: detected field-spanning write (size 32) of single field "hk.kv_val" at drivers/net/wireless/ath/key.c:506 (size 16)

Link: https://bbs.archlinux.org/viewtopic.php?id=282254
Cc: Kalle Valo <kvalo@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230210054310.never.554-kees@kernel.org
drivers/net/wireless/ath/ath.h
drivers/net/wireless/ath/key.c