From: Kalle Valo <kvalo@kernel•org>
To: Kees Cook <keescook@chromium•org>
Cc: Luca Coelho <luciano.coelho@intel•com>,
"David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>,
Lee Jones <lee.jones@linaro•org>,
Johannes Berg <johannes.berg@intel•com>,
linux-wireless@vger•kernel.org, netdev@vger•kernel.org,
Andy Lavr <andy.lavr@gmail•com>,
Gregory Greenman <gregory.greenman@intel•com>,
Eric Dumazet <edumazet@google•com>,
Paolo Abeni <pabeni@redhat•com>,
linux-kernel@vger•kernel.org, linux-hardening@vger•kernel.org
Subject: Re: [PATCH] iwlwifi: calib: Refactor iwl_calib_result usage for clarity
Date: Fri, 02 Sep 2022 06:20:26 +0300 [thread overview]
Message-ID: <87ilm6ea2t.fsf@kernel.org> (raw)
In-Reply-To: <20220901204558.2256458-1-keescook@chromium.org> (Kees Cook's message of "Thu, 1 Sep 2022 13:45:58 -0700")
Kees Cook <keescook@chromium•org> writes:
> 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@intel•com>
> Cc: Kalle Valo <kvalo@codeaurora•org>
> Cc: "David S. Miller" <davem@davemloft•net>
> Cc: Jakub Kicinski <kuba@kernel•org>
> Cc: Lee Jones <lee.jones@linaro•org>
> Cc: Johannes Berg <johannes.berg@intel•com>
> Cc: linux-wireless@vger•kernel.org
> Cc: netdev@vger•kernel.org
> Reported-by: Andy Lavr <andy.lavr@gmail•com>
> Signed-off-by: Kees Cook <keescook@chromium•org>
Gregory, as this fixes a future warning can I take this directly to
wireless-next?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2022-09-02 3:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 20:45 [PATCH] iwlwifi: calib: Refactor iwl_calib_result usage for clarity Kees Cook
2022-09-02 3:20 ` Kalle Valo [this message]
2022-09-07 7:16 ` wifi: " Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ilm6ea2t.fsf@kernel.org \
--to=kvalo@kernel$(echo .)org \
--cc=andy.lavr@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=gregory.greenman@intel$(echo .)com \
--cc=johannes.berg@intel$(echo .)com \
--cc=keescook@chromium$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=lee.jones@linaro$(echo .)org \
--cc=linux-hardening@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-wireless@vger$(echo .)kernel.org \
--cc=luciano.coelho@intel$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox