[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <163903682322.20904.826653912822578576.kvalo@kernel.org>
Date: Thu, 9 Dec 2021 08:00:24 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Kees Cook <keescook@...omium.org>
Cc: Kalle Valo <kvalo@...eaurora.org>,
Kees Cook <keescook@...omium.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ath6kl: Use struct_group() to avoid size-mismatched
casting
Kees Cook <keescook@...omium.org> wrote:
> In builds with -Warray-bounds, casts from smaller objects to larger
> objects will produce warnings. These can be overly conservative, but since
> -Warray-bounds has been finding legitimate bugs, it is desirable to turn
> it on globally. Instead of casting a u32 to a larger object, redefine
> the u32 portion of the header to a separate struct that can be used for
> both u32 operations and the distinct header fields. Silences this warning:
>
> drivers/net/wireless/ath/ath6kl/htc_mbox.c: In function 'htc_wait_for_ctrl_msg':
> drivers/net/wireless/ath/ath6kl/htc_mbox.c:2275:20: error: array subscript 'struct htc_frame_hdr[0]' is partly outside array bounds of 'u32[1]' {aka 'unsigned int[1]'} [-Werror=array-bounds]
> 2275 | if (htc_hdr->eid != ENDPOINT_0)
> | ^~
> drivers/net/wireless/ath/ath6kl/htc_mbox.c:2264:13: note: while referencing 'look_ahead'
> 2264 | u32 look_ahead;
> | ^~~~~~~~~~
>
> This change results in no executable instruction differences.
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: Kalle Valo <quic_kvalo@...cinc.com>
Patch applied to ath-next branch of ath.git, thanks.
e3128a9d482c ath6kl: Use struct_group() to avoid size-mismatched casting
--
https://patchwork.kernel.org/project/linux-wireless/patch/20211207063538.2767954-1-keescook@chromium.org/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists