diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c index 492fe6a5ebf2..d1fd31a6dd1a 100644 --- a/drivers/md/dm-stats.c +++ b/drivers/md/dm-stats.c @@ -792,6 +792,8 @@ static int message_stats_create(struct mapped_device *md, return -EINVAL; if (sscanf(argv[2], "/%u%c", &divisor, &dummy) == 1) { + if (!divisor) + return -EINVAL; step = end - start; if (do_div(step, divisor)) step++;