aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-stripe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-stripe.c')
-rw-r--r--drivers/md/dm-stripe.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index ea5e878a30b9..d907ca6227ce 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -94,7 +94,7 @@ static int get_stripe(struct dm_target *ti, struct stripe_c *sc,
94static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) 94static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
95{ 95{
96 struct stripe_c *sc; 96 struct stripe_c *sc;
97 sector_t width; 97 sector_t width, tmp_len;
98 uint32_t stripes; 98 uint32_t stripes;
99 uint32_t chunk_size; 99 uint32_t chunk_size;
100 int r; 100 int r;
@@ -116,15 +116,16 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
116 } 116 }
117 117
118 width = ti->len; 118 width = ti->len;
119 if (sector_div(width, chunk_size)) { 119 if (sector_div(width, stripes)) {
120 ti->error = "Target length not divisible by " 120 ti->error = "Target length not divisible by "
121 "chunk size"; 121 "number of stripes";
122 return -EINVAL; 122 return -EINVAL;
123 } 123 }
124 124
125 if (sector_div(width, stripes)) { 125 tmp_len = width;
126 if (sector_div(tmp_len, chunk_size)) {
126 ti->error = "Target length not divisible by " 127 ti->error = "Target length not divisible by "
127 "number of stripes"; 128 "chunk size";
128 return -EINVAL; 129 return -EINVAL;
129 } 130 }
130 131