]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm-stripe.c
[PATCH] dm stripe: Fix bounds
[linux-2.6-omap-h63xx.git] / drivers / md / dm-stripe.c
index ab89278a56bf4b7537498819c1fe54dbd1458e54..697aacafb02aedb3dd68ef3d97deda93a007b9ed 100644 (file)
@@ -103,9 +103,15 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
                return -EINVAL;
        }
 
+       if (((uint32_t)ti->len) & (chunk_size - 1)) {
+               ti->error = "dm-stripe: Target length not divisible by "
+                   "chunk size";
+               return -EINVAL;
+       }
+
        width = ti->len;
        if (sector_div(width, stripes)) {
-               ti->error = "dm-stripe: Target length not divisable by "
+               ti->error = "dm-stripe: Target length not divisible by "
                    "number of stripes";
                return -EINVAL;
        }