aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMike Miller <mike.miller@hp.com>2006-06-23 05:06:07 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-23 10:43:09 -0400
commit98bd34eaf1a7d1f2ed9c4e5d3a9664d3dcdd2159 (patch)
treed14de7352fa3d0be85401c472e9a58afab03dadf /fs
parent125e18745f16685f69a34fd6130d47598fc4bf54 (diff)
[PATCH] make kernel warn about incorrectly sized partitions
Sometimes partitions claim to be larger than the reported capacity of a disk device. This patch makes the kernel warn about those partitions. We still permit these patitions to be used. Quoting Andries Brouwer <Andries.Brouwer@cwi.nl>: Case 1: The kernel is mistaken about the size of the disk. (There are commands to clip a disk to a certain capacity, there are jumpers to tell a disk that it should report a certain capacity etc. Usually this is because of BIOS bugs. In bad cases the machine will crash in the BIOS and hence fail to boot if the disk reports full capacity.) In such cases actually accessing the blocks of the partition may work fine, or may work fine after running an unclip utility. I wrote "setmax" some years ago precisely for this reason. Case 2: There was a messy partition table (maybe just a rounding error) but the actual filesystem on the partition is contained in the physical disk. Now using the filesystem goes without problem. Case 3: Both partition and filesystem extend beyond the end of the disk. In forensic or debugging situations one often uses a copy of the start of a disk. Now access beyond the end gives an expected I/O error. Signed-off-by: Mike Miller <mike.miller@hp.com> Signed-off-by: Stephen Cameron <steve.cameron@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/partitions/check.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index cd885b23cb5c..2ef313a96b66 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -484,6 +484,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
484 sector_t from = state->parts[p].from; 484 sector_t from = state->parts[p].from;
485 if (!size) 485 if (!size)
486 continue; 486 continue;
487 if (from + size > get_capacity(disk)) {
488 printk(" %s: p%d exceeds device capacity\n",
489 disk->disk_name, p);
490 }
487 add_partition(disk, p, from, size); 491 add_partition(disk, p, from, size);
488#ifdef CONFIG_BLK_DEV_MD 492#ifdef CONFIG_BLK_DEV_MD
489 if (state->parts[p].flags) 493 if (state->parts[p].flags)