diff options
-rw-r--r-- | drivers/block/brd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index bae9a3d4e15b..e9a19d99f928 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -581,6 +581,9 @@ static int __init brd_init(void) | |||
581 | if (max_part > 0) | 581 | if (max_part > 0) |
582 | part_shift = fls(max_part); | 582 | part_shift = fls(max_part); |
583 | 583 | ||
584 | if ((1UL << part_shift) > DISK_MAX_PARTS) | ||
585 | return -EINVAL; | ||
586 | |||
584 | if (rd_nr > 1UL << (MINORBITS - part_shift)) | 587 | if (rd_nr > 1UL << (MINORBITS - part_shift)) |
585 | return -EINVAL; | 588 | return -EINVAL; |
586 | 589 | ||