From: Simon Horman <simon.horman@corigine.com> To: Kees Cook <keescook@chromium.org> Cc: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: Avoid truncating allocation Date: Sat, 28 Jan 2023 14:40:26 +0100 [thread overview] Message-ID: <Y9UlyupsZIwjIULs@corigine.com> (raw) In-Reply-To: <20230127223853.never.014-kees@kernel.org> 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@chromium.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@corigine.com>
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <simon.horman@corigine.com> To: Kees Cook <keescook@chromium.org> Cc: Felix Fietkau <nbd@nbd.name>, John Crispin <john@phrozen.org>, Sean Wang <sean.wang@mediatek.com>, Mark Lee <Mark-MC.Lee@mediatek.com>, Lorenzo Bianconi <lorenzo@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: Avoid truncating allocation Date: Sat, 28 Jan 2023 14:40:26 +0100 [thread overview] Message-ID: <Y9UlyupsZIwjIULs@corigine.com> (raw) In-Reply-To: <20230127223853.never.014-kees@kernel.org> 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@chromium.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@corigine.com> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-01-28 13:40 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-27 22:38 [PATCH] net: ethernet: mtk_eth_soc: Avoid truncating allocation Kees Cook 2023-01-27 22:38 ` Kees Cook 2023-01-28 13:40 ` Simon Horman [this message] 2023-01-28 13:40 ` Simon Horman 2023-01-31 10:10 ` patchwork-bot+netdevbpf 2023-01-31 10:10 ` patchwork-bot+netdevbpf
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=Y9UlyupsZIwjIULs@corigine.com \ --to=simon.horman@corigine.com \ --cc=Mark-MC.Lee@mediatek.com \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=john@phrozen.org \ --cc=keescook@chromium.org \ --cc=kuba@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-hardening@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=lorenzo@kernel.org \ --cc=matthias.bgg@gmail.com \ --cc=nbd@nbd.name \ --cc=netdev@vger.kernel.org \ --cc=pabeni@redhat.com \ --cc=sean.wang@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.