[PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name

Subsystems: networking drivers, the rest

STALE5333d

4 messages, 4 authors, 2012-01-31 · open the first message on its own page

[PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name

From: Richard Zhao <hidden>
Date: 2012-01-30 08:08:12

Fix the bug that we got wrong phy_name on imx6q sabrelite board.
snprintf used wrong length of phy_name.
phy_name length is MII_BUS_ID_SIZE + 3 rather not MII_BUS_ID_SIZE.
I change it to sizeof(phy_name).

Signed-off-by: Richard Zhao <redacted>
---
 drivers/net/ethernet/freescale/fec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 7b25e9c..1c7aad8 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -990,7 +990,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 		phy_id = 0;
 	}
 
-	snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
+	snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
 	phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0,
 			      fep->phy_interface);
 	if (IS_ERR(phy_dev)) {
-- 
1.7.5.4

[PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name

From: Shawn Guo <hidden>
Date: 2012-01-30 09:51:36

On Mon, Jan 30, 2012 at 04:08:12PM +0800, Richard Zhao wrote:
Fix the bug that we got wrong phy_name on imx6q sabrelite board.
snprintf used wrong length of phy_name.
phy_name length is MII_BUS_ID_SIZE + 3 rather not MII_BUS_ID_SIZE.
I change it to sizeof(phy_name).

Signed-off-by: Richard Zhao <redacted>
Acked-by: Shawn Guo <redacted>

Since this patch fixes a regression seen on v3.3-rc1, it may be
suitable for -rc series.

The offending commit for the regression would be 391420f
(fec: use an unique MDIO bus name.) which increases the string
length of fep->mii_bus->id consequently mdio_bus_id.

Regards,
Shawn
quoted hunk
---
 drivers/net/ethernet/freescale/fec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 7b25e9c..1c7aad8 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -990,7 +990,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
 		phy_id = 0;
 	}
 
-	snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
+	snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
 	phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0,
 			      fep->phy_interface);
 	if (IS_ERR(phy_dev)) {
-- 
1.7.5.4

[PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name

From: florian@openwrt.org (Florian Fainelli)
Date: 2012-01-30 11:07:00


On 01/30/12 10:51, Shawn Guo wrote:
On Mon, Jan 30, 2012 at 04:08:12PM +0800, Richard Zhao wrote:
quoted
Fix the bug that we got wrong phy_name on imx6q sabrelite board.
snprintf used wrong length of phy_name.
phy_name length is MII_BUS_ID_SIZE + 3 rather not MII_BUS_ID_SIZE.
I change it to sizeof(phy_name).

Signed-off-by: Richard Zhao<redacted>
Acked-by: Shawn Guo<redacted>

Since this patch fixes a regression seen on v3.3-rc1, it may be
suitable for -rc series.

The offending commit for the regression would be 391420f
(fec: use an unique MDIO bus name.) which increases the string
length of fep->mii_bus->id consequently mdio_bus_id.
Looks good to me since I introduced that "regression", but you already 
had a bug before my patch.

Acked-by: Florian Fainelli <florian@openwrt.org>
Regards,
Shawn
quoted
---
  drivers/net/ethernet/freescale/fec.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 7b25e9c..1c7aad8 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -990,7 +990,7 @@ static int fec_enet_mii_probe(struct net_device *ndev)
  		phy_id = 0;
  	}

-	snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
+	snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id);
  	phy_dev = phy_connect(ndev, phy_name,&fec_enet_adjust_link, 0,
  			      fep->phy_interface);
  	if (IS_ERR(phy_dev)) {
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name

From: davem@davemloft.net (David Miller)
Date: 2012-01-31 21:18:02

From: Richard Zhao <redacted>
Date: Mon, 30 Jan 2012 16:08:12 +0800
Fix the bug that we got wrong phy_name on imx6q sabrelite board.
snprintf used wrong length of phy_name.
phy_name length is MII_BUS_ID_SIZE + 3 rather not MII_BUS_ID_SIZE.
I change it to sizeof(phy_name).

Signed-off-by: Richard Zhao <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help