2022-05-11 09:20:32

by Yang Yingliang

[permalink] [raw]
Subject: [PATCH] net: ethernet: mediatek: ppe: fix wrong size passed to memset()

'foe_table' is a pointer, the real size of struct mtk_foe_entry
should be pass to memset().

Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
Signed-off-by: Yang Yingliang <[email protected]>
---
drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c
index 3ad10c793308..66298e2235c9 100644
--- a/drivers/net/ethernet/mediatek/mtk_ppe.c
+++ b/drivers/net/ethernet/mediatek/mtk_ppe.c
@@ -395,7 +395,7 @@ static void mtk_ppe_init_foe_table(struct mtk_ppe *ppe)
static const u8 skip[] = { 12, 25, 38, 51, 76, 89, 102 };
int i, k;

- memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(ppe->foe_table));
+ memset(ppe->foe_table, 0, MTK_PPE_ENTRIES * sizeof(*ppe->foe_table));

if (!IS_ENABLED(CONFIG_SOC_MT7621))
return;
--
2.25.1



2022-05-11 10:59:38

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] net: ethernet: mediatek: ppe: fix wrong size passed to memset()

On 11.05.22 05:08, Yang Yingliang wrote:
> 'foe_table' is a pointer, the real size of struct mtk_foe_entry
> should be pass to memset().
>
> Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
> Signed-off-by: Yang Yingliang <[email protected]>

Acked-by: Felix Fietkau <[email protected]>

Thanks,

- Felix


2022-05-14 02:06:01

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH] net: ethernet: mediatek: ppe: fix wrong size passed to memset()

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <[email protected]>:

On Wed, 11 May 2022 11:08:29 +0800 you wrote:
> 'foe_table' is a pointer, the real size of struct mtk_foe_entry
> should be pass to memset().
>
> Fixes: ba37b7caf1ed ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
> Signed-off-by: Yang Yingliang <[email protected]>
> ---
> drivers/net/ethernet/mediatek/mtk_ppe.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- net: ethernet: mediatek: ppe: fix wrong size passed to memset()
https://git.kernel.org/netdev/net/c/00832b1d1a39

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html