diff options
author | Abdel Benamrouche <draconux@gmail.com> | 2008-07-25 04:48:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:44 -0400 |
commit | 04ebd4aee52b06a2c38127d9208546e5b96f3a19 (patch) | |
tree | 25014f06e7bf53ec0b51d717a6a8d0cfb545d985 | |
parent | d805dda412346225a50af2d399d958a4bc676c38 (diff) |
block/ioctl.c and fs/partition/check.c: check value returned by add_partition()
Now that add_partition() has been aught to propagate errors, let's check them.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Abdel Benamrouche <draconux@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | block/ioctl.c | 5 | ||||
-rw-r--r-- | fs/partitions/check.c | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index 52d6385216ad..77185e5c026a 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -17,6 +17,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
17 | long long start, length; | 17 | long long start, length; |
18 | int part; | 18 | int part; |
19 | int i; | 19 | int i; |
20 | int err; | ||
20 | 21 | ||
21 | if (!capable(CAP_SYS_ADMIN)) | 22 | if (!capable(CAP_SYS_ADMIN)) |
22 | return -EACCES; | 23 | return -EACCES; |
@@ -61,9 +62,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user | |||
61 | } | 62 | } |
62 | } | 63 | } |
63 | /* all seems OK */ | 64 | /* all seems OK */ |
64 | add_partition(disk, part, start, length, ADDPART_FLAG_NONE); | 65 | err = add_partition(disk, part, start, length, ADDPART_FLAG_NONE); |
65 | mutex_unlock(&bdev->bd_mutex); | 66 | mutex_unlock(&bdev->bd_mutex); |
66 | return 0; | 67 | return err; |
67 | case BLKPG_DEL_PARTITION: | 68 | case BLKPG_DEL_PARTITION: |
68 | if (!disk->part[part-1]) | 69 | if (!disk->part[part-1]) |
69 | return -ENXIO; | 70 | return -ENXIO; |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 2e6413fbd2d8..7d6b34e201db 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -499,10 +499,16 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | |||
499 | if (!size) | 499 | if (!size) |
500 | continue; | 500 | continue; |
501 | if (from + size > get_capacity(disk)) { | 501 | if (from + size > get_capacity(disk)) { |
502 | printk(" %s: p%d exceeds device capacity\n", | 502 | printk(KERN_ERR " %s: p%d exceeds device capacity\n", |
503 | disk->disk_name, p); | 503 | disk->disk_name, p); |
504 | continue; | ||
505 | } | ||
506 | res = add_partition(disk, p, from, size, state->parts[p].flags); | ||
507 | if (res) { | ||
508 | printk(KERN_ERR " %s: p%d could not be added: %d\n", | ||
509 | disk->disk_name, p, -res); | ||
510 | continue; | ||
504 | } | 511 | } |
505 | add_partition(disk, p, from, size, state->parts[p].flags); | ||
506 | #ifdef CONFIG_BLK_DEV_MD | 512 | #ifdef CONFIG_BLK_DEV_MD |
507 | if (state->parts[p].flags & ADDPART_FLAG_RAID) | 513 | if (state->parts[p].flags & ADDPART_FLAG_RAID) |
508 | md_autodetect_dev(bdev->bd_dev+p); | 514 | md_autodetect_dev(bdev->bd_dev+p); |