[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9UlyupsZIwjIULs@corigine.com>
Date: Sat, 28 Jan 2023 14:40:26 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Kees Cook <keescook@...omium.org>
Cc: Felix Fietkau <nbd@....name>, John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: Avoid truncating allocation
On Fri, Jan 27, 2023 at 02:38:54PM -0800, Kees Cook wrote:
> There doesn't appear to be a reason to truncate the allocation used for
> flow_info, so do a full allocation and remove the unused empty struct.
> GCC does not like having a reference to an object that has been
> partially allocated, as bounds checking may become impossible when
> such an object is passed to other code. Seen with GCC 13:
>
> ../drivers/net/ethernet/mediatek/mtk_ppe.c: In function 'mtk_foe_entry_commit_subflow':
> ../drivers/net/ethernet/mediatek/mtk_ppe.c:623:18: warning: array subscript 'struct mtk_flow_entry[0]' is partly outside array bounds of 'unsigned char[48]' [-Warray-bounds=]
> 623 | flow_info->l2_data.base_flow = entry;
> | ^~
>
...
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
> drivers/net/ethernet/mediatek/mtk_ppe.c | 3 +--
> drivers/net/ethernet/mediatek/mtk_ppe.h | 1 -
> 2 files changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Simon Horman <simon.horman@...igine.com>
Powered by blists - more mailing lists