]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: cortina_ni: buffer overrun
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 20 Feb 2021 09:44:04 +0000 (10:44 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 24 Feb 2021 21:51:49 +0000 (16:51 -0500)
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 <xypron.glpk@gmx.de>
Reviewed-By: Ramon Fried <rfried.dev@gmail.com>
drivers/net/cortina_ni.c

index ee424d95bc0bd7446d5b796ab7a506978d022864..ef6ecd88b0ce4fec7723c2fe8a21ad98714b762d 100644 (file)
@@ -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);