[PATCH] dm stripe: Fix bounds
Changes
1 files changed · +7 −1
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| drivers/md/dm-stripe.c | modified | +7 | −1 | View file |
drivers/md/dm-stripe.c
View filediff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index ab89278..697aaca 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -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;
}