]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[AOE]: Add get_unaligned() calls where needed.
authorDavid S. Miller <davem@davemloft.net>
Fri, 2 Mar 2007 02:30:08 +0000 (18:30 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 2 Mar 2007 23:22:55 +0000 (15:22 -0800)
Based upon a report by Andrew Walrond.

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/block/aoe/aoecmd.c
drivers/block/aoe/aoenet.c

index bb022ed4a8667936288ac328bde688a4dfbe16be..8d17d8df36621e479e3c2b7d4760ecc2baee2346 100644 (file)
@@ -530,7 +530,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        u16 aoemajor;
 
        hin = (struct aoe_hdr *) skb->mac.raw;
-       aoemajor = be16_to_cpu(hin->major);
+       aoemajor = be16_to_cpu(get_unaligned(&hin->major));
        d = aoedev_by_aoeaddr(aoemajor, hin->minor);
        if (d == NULL) {
                snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response "
@@ -542,7 +542,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
 
        spin_lock_irqsave(&d->lock, flags);
 
-       n = be32_to_cpu(hin->tag);
+       n = be32_to_cpu(get_unaligned(&hin->tag));
        f = getframe(d, n);
        if (f == NULL) {
                calc_rttavg(d, -tsince(n));
@@ -550,9 +550,9 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                snprintf(ebuf, sizeof ebuf,
                        "%15s e%d.%d    tag=%08x@%08lx\n",
                        "unexpected rsp",
-                       be16_to_cpu(hin->major),
+                       be16_to_cpu(get_unaligned(&hin->major)),
                        hin->minor,
-                       be32_to_cpu(hin->tag),
+                       be32_to_cpu(get_unaligned(&hin->tag)),
                        jiffies);
                aoechr_error(ebuf);
                return;
@@ -631,7 +631,7 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                        printk(KERN_INFO
                                "aoe: unrecognized ata command %2.2Xh for %d.%d\n",
                                ahout->cmdstat,
-                               be16_to_cpu(hin->major),
+                               be16_to_cpu(get_unaligned(&hin->major)),
                                hin->minor);
                }
        }
@@ -733,7 +733,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
         * Enough people have their dip switches set backwards to
         * warrant a loud message for this special case.
         */
-       aoemajor = be16_to_cpu(h->major);
+       aoemajor = be16_to_cpu(get_unaligned(&h->major));
        if (aoemajor == 0xfff) {
                printk(KERN_ERR "aoe: Warning: shelf address is all ones.  "
                        "Check shelf dip switches.\n");
index 9626e0f5da9dd4edc73d7ab559b3aa6d233e0836..aab6d91a2c2285b03c50a1249b49d333f70dfb20 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/blkdev.h>
 #include <linux/netdevice.h>
 #include <linux/moduleparam.h>
+#include <asm/unaligned.h>
 #include "aoe.h"
 
 #define NECODES 5
@@ -123,7 +124,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
        skb_push(skb, ETH_HLEN);        /* (1) */
 
        h = (struct aoe_hdr *) skb->mac.raw;
-       n = be32_to_cpu(h->tag);
+       n = be32_to_cpu(get_unaligned(&h->tag));
        if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31))
                goto exit;
 
@@ -133,7 +134,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
                        n = 0;
                if (net_ratelimit())
                        printk(KERN_ERR "aoe: error packet from %d.%d; ecode=%d '%s'\n",
-                              be16_to_cpu(h->major), h->minor, 
+                              be16_to_cpu(get_unaligned(&h->major)), h->minor,
                               h->err, aoe_errlist[n]);
                goto exit;
        }