net: cortina_ni: buffer overrun
PATCH 1/1 net: cortina_ni: buffer overrun
When copying to a u32 field we should use sizeof(u32) and not sizeof(*u32) in memcpy.
On 64bit systems like cortina_presidio-asic-emmc_defconfig using sizeof(*u32) leads to a buffer overrun.
Fixes febe13b438b3 ("net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs")
Signed-off-by Heinrich Schuchardt <[email protected]>
--- drivers/net/cortina_ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cortina_ni.c +1 -1
@@ -713,7 +713,7 @@ static int cortina_eth_recv(struct udevice *dev, int flags, uchar **packetp) priv->rx_xram_end_adr);memcpy (&packet_status, rx_xram_ptr, -sizeof (rx_xram_ptr)); +sizeof (*rx_xram_ptr));if (packet_status.valid ==0 ) {debug ("%s: Invalid Packet !!, " , __func__);debug ("next_link=%d\n" , next_link);
--
2.30.0
PATCH 1/1 net: cortina_ni: buffer overrun
Quoted 27 lines · Heinrich Schuchardt
When copying to a u32 field we should use sizeof(u32) and not
sizeof(*u32)in memcpy.On 64bit systems like cortina_presidio-asic-emmc_defconfig using
sizeof(*u32)leads to a buffer overrun.Fixes febe13b438b3 ("net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs")Signed-off-by Heinrich Schuchardt <[email protected]>--- drivers/net/cortina_ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/cortina_ni.c +1
-2@@ -713,7 +713,7 @@ static int cortina_eth_recv(struct udevice *dev, int flags, uchar **packetp) priv->rx_xram_end_adr);memcpy (&packet_status, rx_xram_ptr, -sizeof (rx_xram_ptr)); +sizeof (*rx_xram_ptr));if (packet_status.valid ==0 ) {debug ("%s: Invalid Packet !!, " , __func__);debug ("next_link=%d\n" , next_link); --
Quoted 2 lines
2.30.0
Reviewed-by Ramon Fried <[email protected]>
PATCH 1/1 net: cortina_ni: buffer overrun
In reply to Heinrich SchuchardtQuoted 9 lines · Heinrich Schuchardt
When copying to a u32 field we should use sizeof(u32) and not
sizeof(*u32)in memcpy.On 64bit systems like cortina_presidio-asic-emmc_defconfig using
sizeof(*u32)leads to a buffer overrun.Fixes febe13b438b3 ("net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs")Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Ramon Fried <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/6ef899f9/attachment.sig>