aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/ibm.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-03-14 15:18:01 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-03-14 15:18:01 -0500
commitf33b5d783b4f56be5ace6a1c98fb5f76b2d2d07d (patch)
treeb027b5f3429d416b3da5b9195024007dab062a5e /fs/partitions/ibm.c
parente935d5da8e5d12fabe5b632736c50eae0427e8c8 (diff)
parent67963132638e67ad3c5aa16765e6f3f2f3cdd85c (diff)
Merge ../linux-2.6
Diffstat (limited to 'fs/partitions/ibm.c')
-rw-r--r--fs/partitions/ibm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c
index 78010ad60e47..1e4a93835fed 100644
--- a/fs/partitions/ibm.c
+++ b/fs/partitions/ibm.c
@@ -52,6 +52,7 @@ int
52ibm_partition(struct parsed_partitions *state, struct block_device *bdev) 52ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
53{ 53{
54 int blocksize, offset, size; 54 int blocksize, offset, size;
55 loff_t i_size;
55 dasd_information_t *info; 56 dasd_information_t *info;
56 struct hd_geometry *geo; 57 struct hd_geometry *geo;
57 char type[5] = {0,}; 58 char type[5] = {0,};
@@ -63,6 +64,13 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
63 unsigned char *data; 64 unsigned char *data;
64 Sector sect; 65 Sector sect;
65 66
67 blocksize = bdev_hardsect_size(bdev);
68 if (blocksize <= 0)
69 return 0;
70 i_size = i_size_read(bdev->bd_inode);
71 if (i_size == 0)
72 return 0;
73
66 if ((info = kmalloc(sizeof(dasd_information_t), GFP_KERNEL)) == NULL) 74 if ((info = kmalloc(sizeof(dasd_information_t), GFP_KERNEL)) == NULL)
67 goto out_noinfo; 75 goto out_noinfo;
68 if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) 76 if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL)
@@ -73,9 +81,6 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
73 if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || 81 if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 ||
74 ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0) 82 ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0)
75 goto out_noioctl; 83 goto out_noioctl;
76
77 if ((blocksize = bdev_hardsect_size(bdev)) <= 0)
78 goto out_badsect;
79 84
80 /* 85 /*
81 * Get volume label, extract name and type. 86 * Get volume label, extract name and type.
@@ -111,7 +116,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
111 } else { 116 } else {
112 printk("CMS1/%8s:", name); 117 printk("CMS1/%8s:", name);
113 offset = (info->label_block + 1); 118 offset = (info->label_block + 1);
114 size = bdev->bd_inode->i_size >> 9; 119 size = i_size >> 9;
115 } 120 }
116 put_partition(state, 1, offset*(blocksize >> 9), 121 put_partition(state, 1, offset*(blocksize >> 9),
117 size-offset*(blocksize >> 9)); 122 size-offset*(blocksize >> 9));
@@ -168,7 +173,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
168 else 173 else
169 printk("(nonl)/%8s:", name); 174 printk("(nonl)/%8s:", name);
170 offset = (info->label_block + 1); 175 offset = (info->label_block + 1);
171 size = (bdev->bd_inode->i_size >> 9); 176 size = i_size >> 9;
172 put_partition(state, 1, offset*(blocksize >> 9), 177 put_partition(state, 1, offset*(blocksize >> 9),
173 size-offset*(blocksize >> 9)); 178 size-offset*(blocksize >> 9));
174 } 179 }
@@ -180,7 +185,6 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
180 return 1; 185 return 1;
181 186
182out_readerr: 187out_readerr:
183out_badsect:
184out_noioctl: 188out_noioctl:
185 kfree(label); 189 kfree(label);
186out_nolab: 190out_nolab: