]> git.baikalelectronics.ru Git - kernel.git/commit
net: ethernet: mtk_eth_soc: fix usage of foe_entry_size
authorDaniel Golle <daniel@makrotopia.org>
Sun, 25 Sep 2022 14:48:43 +0000 (15:48 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 27 Sep 2022 14:43:54 +0000 (07:43 -0700)
commitb08509cc817302501f49b914b44835837308e94e
treebd9a220f2a3ba2f136d6a21c4e013cce6db8c980
parent93a05fe2be8de703b64837a705f6baa11e989f79
net: ethernet: mtk_eth_soc: fix usage of foe_entry_size

As sizeof(hwe->data) can now longer be used as the actual size depends
on foe_entry_size, in commit e17be858137834
("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc") the
use of sizeof(hwe->data) is hence replaced.

However, replacing it with ppe->eth->soc->foe_entry_size is wrong as
foe_entry_size represents the size of the whole descriptor and not just
the 'data' field.

Fix this by subtracing the size of the only other field in the struct
'ib1', so we actually end up with the correct size to be copied to the
data field.

Reported-by: Chen Minqiang <ptpt52@gmail.com>
Fixes: e17be858137834 ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/YzBqPIgQR2gLrPoK@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mediatek/mtk_ppe.c