diff mbox

net: stmmac: Fix incorrect memcpy source memory

Message ID 1464216023-6428-1-git-send-email-marex@denx.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Marek Vasut May 25, 2016, 10:40 p.m. UTC
The memcpy() currently copies mdio_bus_data into new_bus->irq, which
makes no sense, since the mdio_bus_data structure contains more than
just irqs. The code was likely supposed to copy mdio_bus_data->irqs
into the new_bus->irq instead, so fix this.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller May 26, 2016, 12:20 a.m. UTC | #1
From: Marek Vasut <marex@denx.de>
Date: Thu, 26 May 2016 00:40:23 +0200

> The memcpy() currently copies mdio_bus_data into new_bus->irq, which
> makes no sense, since the mdio_bus_data structure contains more than
> just irqs. The code was likely supposed to copy mdio_bus_data->irqs
> into the new_bus->irq instead, so fix this.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>

Fixes: e7f4dc3536a4 ("mdio: Move allocation of interrupts into core")

Andrew, please review.
Andrew Lunn May 26, 2016, 12:26 a.m. UTC | #2
On Thu, May 26, 2016 at 12:40:23AM +0200, Marek Vasut wrote:
> The memcpy() currently copies mdio_bus_data into new_bus->irq, which
> makes no sense, since the mdio_bus_data structure contains more than
> just irqs. The code was likely supposed to copy mdio_bus_data->irqs
> into the new_bus->irq instead, so fix this.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

	     Andrew
David Miller May 26, 2016, 4:43 a.m. UTC | #3
From: Andrew Lunn <andrew@lunn.ch>
Date: Thu, 26 May 2016 02:26:25 +0200

> On Thu, May 26, 2016 at 12:40:23AM +0200, Marek Vasut wrote:
>> The memcpy() currently copies mdio_bus_data into new_bus->irq, which
>> makes no sense, since the mdio_bus_data structure contains more than
>> just irqs. The code was likely supposed to copy mdio_bus_data->irqs
>> into the new_bus->irq instead, so fix this.
>> 
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Applied and queued up for -stable, thanks.
diff mbox

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3f83c36..ec29585 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -297,7 +297,7 @@  int stmmac_mdio_register(struct net_device *ndev)
 		return -ENOMEM;
 
 	if (mdio_bus_data->irqs)
-		memcpy(new_bus->irq, mdio_bus_data, sizeof(new_bus->irq));
+		memcpy(new_bus->irq, mdio_bus_data->irqs, sizeof(new_bus->irq));
 
 #ifdef CONFIG_OF
 	if (priv->device->of_node)