Re: [PATCH] wifi: iwlwifi: dvm: Add struct_group for struct iwl_keyinfo keys
From: Simon Horman
Date: Sun Feb 19 2023 - 08:41:36 EST
On Sat, Feb 18, 2023 at 11:11:00AM -0800, Kees Cook wrote:
> Function iwlagn_send_sta_key() was trying to write across multiple
> structure members in a single memcpy(). Add a struct group "keys" to
> let the compiler see the intended bounds of the memcpy, which includes
> the tkip keys as well. Silences false positive memcpy() run-time
> warning:
>
> memcpy: detected field-spanning write (size 32) of single field "sta_cmd.key.key" at drivers/net/wireless/intel/iwlwifi/dvm/sta.c:1103 (size 16)
>
> Link: https://www.alionet.org/index.php?topic=1469.0
> Cc: Gregory Greenman <gregory.greenman@xxxxxxxxx>
> Cc: Kalle Valo <kvalo@xxxxxxxxxx>
> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
> Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
> Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
> Cc: Paolo Abeni <pabeni@xxxxxxxxxx>
> Cc: Johannes Berg <johannes.berg@xxxxxxxxx>
> Cc: Benjamin Berg <benjamin.berg@xxxxxxxxx>
> Cc: Sriram R <quic_srirrama@xxxxxxxxxxx>
> Cc: linux-wireless@xxxxxxxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>