"freesize" can be equal 0 after rounding to the chunk's size. Creating should be aborted in such case. Signed-off-by: Lukasz Dorau <lukasz.dorau@xxxxxxxxx> --- Create.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Create.c b/Create.c index afcf1a5..f5b7194 100644 --- a/Create.c +++ b/Create.c @@ -399,6 +399,11 @@ int Create(struct supertype *st, char *mddev, if (s->chunk && s->chunk != UnSet) { /* round to chunk size */ freesize = freesize & ~(s->chunk-1); + if (!freesize) { + pr_err("no free space left on %s\n", dname); + fail = 1; + continue; + } if (do_default_chunk) { /* default chunk was just set */ if (c->verbose > 0) -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html