public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] usbnet: pegasus: endian bug in write_mii_word()
@ 2013-05-03  6:44 Dan Carpenter
  2013-05-03  8:23 ` David Laight
  2013-05-03 20:12 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2013-05-03  6:44 UTC (permalink / raw)
  To: Petko Manolov
  Cc: Greg Kroah-Hartman, David S. Miller,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

We're only passing the two high bits of an integer.  It works for little
endian but not for big endian.

Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 0969905..03e8a15 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -256,8 +256,9 @@ static int mdio_read(struct net_device *dev, int phy_id, int loc)
 static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
 {
 	pegasus_t *pegasus = netdev_priv(dev);
+	u16 data = val;
 
-	write_mii_word(pegasus, phy_id, loc, (__u16 *)&val);
+	write_mii_word(pegasus, phy_id, loc, &data);
 }
 
 static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* RE: [patch] usbnet: pegasus: endian bug in write_mii_word()
  2013-05-03  6:44 [patch] usbnet: pegasus: endian bug in write_mii_word() Dan Carpenter
@ 2013-05-03  8:23 ` David Laight
  2013-05-03 20:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Laight @ 2013-05-03  8:23 UTC (permalink / raw)
  To: Dan Carpenter, Petko Manolov
  Cc: Greg Kroah-Hartman, David S. Miller, linux-usb, netdev,
	kernel-janitors

> We're only passing the two high bits of an integer.  It works for little
                                  ^^^^ bytes
> endian but not for big endian.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index 0969905..03e8a15 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -256,8 +256,9 @@ static int mdio_read(struct net_device *dev, int phy_id, int loc)
>  static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
>  {
>  	pegasus_t *pegasus = netdev_priv(dev);
> +	u16 data = val;
> 
> -	write_mii_word(pegasus, phy_id, loc, (__u16 *)&val);
> +	write_mii_word(pegasus, phy_id, loc, &data);
>  }
> 
>  static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
> --
> 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] 3+ messages in thread

* Re: [patch] usbnet: pegasus: endian bug in write_mii_word()
  2013-05-03  6:44 [patch] usbnet: pegasus: endian bug in write_mii_word() Dan Carpenter
  2013-05-03  8:23 ` David Laight
@ 2013-05-03 20:12 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2013-05-03 20:12 UTC (permalink / raw)
  To: dan.carpenter; +Cc: petkan, gregkh, linux-usb, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 3 May 2013 09:44:20 +0300

> We're only passing the two high bits of an integer.  It works for little
> endian but not for big endian.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

s/bits/bytes/, applied, and queued up for stable, thanks

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

end of thread, other threads:[~2013-05-03 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03  6:44 [patch] usbnet: pegasus: endian bug in write_mii_word() Dan Carpenter
2013-05-03  8:23 ` David Laight
2013-05-03 20:12 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox