From 3fa582eaff5fa901b044902554bc44f7bda8e1ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 22:04:21 -0700 Subject: [PATCH] --- yaml --- r: 114899 b: refs/heads/master c: ac0d86f5809598ddcd6bfa0ea8245ccc910e9eac h: refs/heads/master i: 114897: 3149848ae726710f970fb6e920a772a2f547b452 114895: 379b10c699d9a5bef46252f45801dd2fdde5de7d v: v3 --- [refs] | 2 +- trunk/fs/partitions/check.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 521a1c9cba57..89db5d5be211 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6722e45c2de622eaf5f26d370b9de19632ac7478 +refs/heads/master: ac0d86f5809598ddcd6bfa0ea8245ccc910e9eac diff --git a/trunk/fs/partitions/check.c b/trunk/fs/partitions/check.c index 7408227c49c9..fbeb2f372a93 100644 --- a/trunk/fs/partitions/check.c +++ b/trunk/fs/partitions/check.c @@ -538,10 +538,23 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) sector_t from = state->parts[p].from; if (!size) continue; + if (from >= get_capacity(disk)) { + printk(KERN_WARNING + "%s: p%d ignored, start %llu is behind the end of the disk\n", + disk->disk_name, p, (unsigned long long) from); + continue; + } if (from + size > get_capacity(disk)) { + /* + * we can not ignore partitions of broken tables + * created by for example camera firmware, but we + * limit them to the end of the disk to avoid + * creating invalid block devices + */ printk(KERN_WARNING - "%s: p%d exceeds device capacity\n", - disk->disk_name, p); + "%s: p%d size %llu limited to end of disk\n", + disk->disk_name, p, (unsigned long long) size); + size = get_capacity(disk) - from; } res = add_partition(disk, p, from, size, state->parts[p].flags); if (res) {