]> Pileus Git - ~andy/linux/commitdiff
aoe: update and specify AoE address guards and error messages
authorEd Cashin <ecashin@coraid.com>
Fri, 5 Oct 2012 00:16:44 +0000 (17:16 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Oct 2012 18:05:29 +0000 (03:05 +0900)
In general, specific is better when it comes to messages about AoE usage
problems.  Also, explicit checks for the AoE broadcast addresses are
added.

Signed-off-by: Ed Cashin <ecashin@coraid.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/block/aoe/aoe.h
drivers/block/aoe/aoecmd.c

index 7b694f7da2de2529a0032ebc3a67b906d3be2fa4..4ae2468b4a06a44395e503e67d131b40c1720d99 100644 (file)
@@ -49,8 +49,6 @@ struct aoe_hdr {
        __be32 tag;
 };
 
-#define AOE_MAXSHELF (0xffff-1)        /* one less than the broadcast shelf address */
-
 struct aoe_atahdr {
        unsigned char aflags;
        unsigned char errfeat;
index 94e810c36de1e46fea74c30d7427201d47f41380..3804a0af3ef192c441643eee425d06f747b86d97 100644 (file)
@@ -1349,15 +1349,14 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
                        "Check shelf dip switches.\n");
                return;
        }
-       if (aoemajor > AOE_MAXSHELF) {
-               pr_info("aoe: e%ld.%d: shelf number too large\n",
+       if (aoemajor == 0xffff) {
+               pr_info("aoe: e%ld.%d: broadcast shelf number invalid\n",
                        aoemajor, (int) h->minor);
                return;
        }
-
-       d = aoedev_by_aoeaddr(aoemajor, h->minor, 1);
-       if (d == NULL) {
-               pr_info("aoe: device allocation failure\n");
+       if (h->minor == 0xff) {
+               pr_info("aoe: e%ld.%d: broadcast slot number invalid\n",
+                       aoemajor, (int) h->minor);
                return;
        }
 
@@ -1365,6 +1364,12 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        if (n > aoe_maxout)     /* keep it reasonable */
                n = aoe_maxout;
 
+       d = aoedev_by_aoeaddr(aoemajor, h->minor, 1);
+       if (d == NULL) {
+               pr_info("aoe: device allocation failure\n");
+               return;
+       }
+
        spin_lock_irqsave(&d->lock, flags);
 
        t = gettgt(d, h->src);