usbnet: pegasus: endian bug in write_mii_word()
Subsystems (5)
PATCH 1/1 usbnet: pegasus: endian bug in write_mii_word()
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 <[email protected]>
drivers/net/usb/pegasus.c +2 -1
@@ -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)
Quoted 1 line
We're only passing the two high bits of an integer. It works for little
^^^^ bytes
Quoted 23 lines
endian but not for big endian.
Signed-off-by Dan Carpenter <[email protected]>drivers/net/usb/pegasus.c +2
-2@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Dan Carpenter <[email protected]>
Date: Fri, 3 May 2013 09:44:20 +0300
Quoted 4 lines
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 <[email protected]>
s/bits/bytes/, applied, and queued up for stable, thanks