aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/partitions/check.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 7408227c49c9..fbeb2f372a93 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -538,10 +538,23 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
538 sector_t from = state->parts[p].from; 538 sector_t from = state->parts[p].from;
539 if (!size) 539 if (!size)
540 continue; 540 continue;
541 if (from >= get_capacity(disk)) {
542 printk(KERN_WARNING
543 "%s: p%d ignored, start %llu is behind the end of the disk\n",
544 disk->disk_name, p, (unsigned long long) from);
545 continue;
546 }
541 if (from + size > get_capacity(disk)) { 547 if (from + size > get_capacity(disk)) {
548 /*
549 * we can not ignore partitions of broken tables
550 * created by for example camera firmware, but we
551 * limit them to the end of the disk to avoid
552 * creating invalid block devices
553 */
542 printk(KERN_WARNING 554 printk(KERN_WARNING
543 "%s: p%d exceeds device capacity\n", 555 "%s: p%d size %llu limited to end of disk\n",
544 disk->disk_name, p); 556 disk->disk_name, p, (unsigned long long) size);
557 size = get_capacity(disk) - from;
545 } 558 }
546 res = add_partition(disk, p, from, size, state->parts[p].flags); 559 res = add_partition(disk, p, from, size, state->parts[p].flags);
547 if (res) { 560 if (res) {