[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <166253499319.23292.401375353887849776.kvalo@kernel.org>
Date: Wed, 7 Sep 2022 07:16:38 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Luca Coelho <luciano.coelho@...el.com>,
Kees Cook <keescook@...omium.org>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Johannes Berg <johannes.berg@...el.com>,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
Andy Lavr <andy.lavr@...il.com>,
Gregory Greenman <gregory.greenman@...el.com>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity
Kees Cook <keescook@...omium.org> wrote:
> In preparation for FORTIFY_SOURCE performing run-time destination buffer
> bounds checking for memcpy(), refactor the use of struct iwl_calib_result:
>
> - Have struct iwl_calib_result contain struct iwl_calib_cmd since
> functions expect to operate on the "data" flex array in "cmd", which
> follows the "hdr" member.
> - Switch argument passing around to use struct iwl_calib_cmd instead of
> struct iwl_calib_hdr to prepare functions to see the "data" member.
> - Change iwl_calib_set()'s "len" argument to a size_t since it is always
> unsigned and is normally receiving the output of sizeof().
> - Add an explicit length sanity check in iwl_calib_set().
> - Adjust the memcpy() to avoid copying across the now visible composite
> flex array structure.
>
> This avoids the future run-time warning:
>
> memcpy: detected field-spanning write (size 8) of single field "&res->hdr" (size 4)
>
> Cc: Luca Coelho <luciano.coelho@...el.com>
> Cc: Kalle Valo <kvalo@...eaurora.org>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Lee Jones <lee.jones@...aro.org>
> Cc: Johannes Berg <johannes.berg@...el.com>
> Cc: linux-wireless@...r.kernel.org
> Cc: netdev@...r.kernel.org
> Reported-by: Andy Lavr <andy.lavr@...il.com>
> Signed-off-by: Kees Cook <keescook@...omium.org>
Patch applied to wireless-next.git, thanks.
0d24201f47c4 wifi: iwlwifi: calib: Refactor iwl_calib_result usage for clarity
--
https://patchwork.kernel.org/project/linux-wireless/patch/20220901204558.2256458-1-keescook@chromium.org/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists