minor change for dm-strip.c. Tests for correct chunksize before it allocates
the stripe context. [Heinz Mauelshagen]
--- diff/drivers/md/dm-stripe.c 2002-11-29 09:44:59.000000000 +0000
+++ source/drivers/md/dm-stripe.c 2002-11-29 09:46:26.000000000 +0000
@@ -116,6 +116,14 @@
return -EINVAL;
}
+ /*
+ * chunk_size is a power of two
+ */
+ if (!chunk_size || (chunk_size & (chunk_size - 1))) {
+ ti->error = "dm-stripe: Invalid chunk size";
+ return -EINVAL;
+ }
+
if (!multiple(ti->len, stripes, &width)) {
ti->error = "dm-stripe: Target length not divisable by "
"number of stripes";
@@ -132,15 +140,6 @@
sc->stripes = stripes;
sc->stripe_width = width;
- /*
- * chunk_size is a power of two
- */
- if (!chunk_size || (chunk_size & (chunk_size - 1))) {
- ti->error = "dm-stripe: Invalid chunk size";
- kfree(sc);
- return -EINVAL;
- }
-
sc->chunk_mask = ((sector_t) chunk_size) - 1;
for (sc->chunk_shift = 0; chunk_size; sc->chunk_shift++)
chunk_size >>= 1;