vserver 1.9.3
[linux-2.6.git] / drivers / ieee1394 / eth1394.c
index d99ac5d..798537f 100644 (file)
@@ -89,7 +89,7 @@
 #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
 
 static char version[] __devinitdata =
-       "$Rev: 1198 $ Ben Collins <bcollins@debian.org>";
+       "$Rev: 1224 $ Ben Collins <bcollins@debian.org>";
 
 struct fragment_info {
        struct list_head list;
@@ -132,7 +132,7 @@ struct eth1394_node_info {
 };
 
 /* Our ieee1394 highlevel driver */
-#define ETH1394_DRIVER_NAME "ip1394"
+#define ETH1394_DRIVER_NAME "eth1394"
 static const char driver_name[] = ETH1394_DRIVER_NAME;
 
 static kmem_cache_t *packet_task_cache;
@@ -191,7 +191,7 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev);
 static void ether1394_iso(struct hpsb_iso *iso);
 
 static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
-static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr);
+static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr);
 
 static int ether1394_write(struct hpsb_host *host, int srcid, int destid,
                           quadlet_t *data, u64 addr, size_t len, u16 flags);
@@ -290,6 +290,20 @@ static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
+static inline void purge_partial_datagram(struct list_head *old)
+{
+       struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
+       struct list_head *lh, *n;
+
+       list_for_each_safe(lh, n, &pd->frag_info) {
+               struct fragment_info *fi = list_entry(lh, struct fragment_info, list);
+               list_del(lh);
+               kfree(fi);
+       }
+       list_del(old);
+       kfree_skb(pd->skb);
+       kfree(pd);
+}
 
 /******************************************
  * 1394 bus activity functions
@@ -431,9 +445,12 @@ static int eth1394_update(struct unit_directory *ud)
                if (!node)
                        return -ENOMEM;
 
-
                node_info = kmalloc(sizeof(struct eth1394_node_info),
                                    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+               if (!node_info) {
+                       kfree(node);
+                       return -ENOMEM;
+                }
 
                spin_lock_init(&node_info->pdg.lock);
                INIT_LIST_HEAD(&node_info->pdg.list);
@@ -833,7 +850,7 @@ static inline u16 ether1394_type_trans(struct sk_buff *skb,
 
        skb->mac.raw = skb->data;
        skb_pull (skb, ETH1394_HLEN);
-       eth = (struct eth1394hdr*)skb->mac.raw;
+       eth = eth1394_hdr(skb);
 
        if (*eth->h_dest & 1) {
                if (memcmp(eth->h_dest, dev->broadcast, dev->addr_len)==0)
@@ -1078,21 +1095,6 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
        return 0;
 }
 
-static inline void purge_partial_datagram(struct list_head *old)
-{
-       struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
-       struct list_head *lh, *n;
-
-       list_for_each_safe(lh, n, &pd->frag_info) {
-               struct fragment_info *fi = list_entry(lh, struct fragment_info, list);
-               list_del(lh);
-               kfree(fi);
-       }
-       list_del(old);
-       kfree_skb(pd->skb);
-       kfree(pd);
-}
-
 static inline int is_datagram_complete(struct list_head *lh, int dg_size)
 {
        struct partial_datagram *pd = list_entry(lh, struct partial_datagram, list);
@@ -1770,7 +1772,7 @@ static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
 {
        switch(cmd) {
                case SIOCETHTOOL:
-                       return ether1394_ethtool_ioctl(dev, (void *) ifr->ifr_data);
+                       return ether1394_ethtool_ioctl(dev, ifr->ifr_data);
 
                case SIOCGMIIPHY:               /* Get address of MII PHY in use. */
                case SIOCGMIIREG:               /* Read MII PHY register. */
@@ -1782,18 +1784,18 @@ static int ether1394_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd
        return 0;
 }
 
-static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
+static int ether1394_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
 {
        u32 ethcmd;
 
-       if (get_user(ethcmd, (u32 *)useraddr))
+       if (get_user(ethcmd, (u32 __user *)useraddr))
                return -EFAULT;
 
        switch (ethcmd) {
                case ETHTOOL_GDRVINFO: {
                        struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
                        strcpy (info.driver, driver_name);
-                       strcpy (info.version, "$Rev: 1198 $");
+                       strcpy (info.version, "$Rev: 1224 $");
                        /* FIXME XXX provide sane businfo */
                        strcpy (info.bus_info, "ieee1394");
                        if (copy_to_user (useraddr, &info, sizeof (info)))