netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name
@ 2012-01-30  8:08 Richard Zhao
  2012-01-30  9:51 ` Shawn Guo
  2012-01-31 21:18 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Zhao @ 2012-01-30  8:08 UTC (permalink / raw)
  To: netdev
  Cc: davem, shawn.guo, u.kleine-koenig, LW, linux-arm-kernel, patches,
	Richard Zhao

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 <richard.zhao@linaro.org>
---
 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name
  2012-01-30  8:08 [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name Richard Zhao
@ 2012-01-30  9:51 ` Shawn Guo
  2012-01-30 11:07   ` Florian Fainelli
  2012-01-31 21:18 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Shawn Guo @ 2012-01-30  9:51 UTC (permalink / raw)
  To: Richard Zhao
  Cc: netdev, davem, u.kleine-koenig, LW, linux-arm-kernel, patches

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 <richard.zhao@linaro.org>

Acked-by: Shawn Guo <shawn.guo@linaro.org>

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

> ---
>  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
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name
  2012-01-30  9:51 ` Shawn Guo
@ 2012-01-30 11:07   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2012-01-30 11:07 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Richard Zhao, netdev, davem, u.kleine-koenig, LW,
	linux-arm-kernel, patches



On 01/30/12 10:51, Shawn Guo wrote:
> 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<richard.zhao@linaro.org>
>
> Acked-by: Shawn Guo<shawn.guo@linaro.org>
>
> 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
>
>> ---
>>   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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name
  2012-01-30  8:08 [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name Richard Zhao
  2012-01-30  9:51 ` Shawn Guo
@ 2012-01-31 21:18 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2012-01-31 21:18 UTC (permalink / raw)
  To: richard.zhao
  Cc: patches, netdev, u.kleine-koenig, shawn.guo, linux-arm-kernel, LW

From: Richard Zhao <richard.zhao@linaro.org>
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 <richard.zhao@linaro.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-31 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-30  8:08 [PATCH 1/1] net: fec: correct phy_name buffer length when init phy_name Richard Zhao
2012-01-30  9:51 ` Shawn Guo
2012-01-30 11:07   ` Florian Fainelli
2012-01-31 21:18 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).