aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/ibm.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions/ibm.c')
-rw-r--r--fs/partitions/ibm.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c
index d352a7381fed..9f7ad4244f63 100644
--- a/fs/partitions/ibm.c
+++ b/fs/partitions/ibm.c
@@ -43,7 +43,7 @@ cchhb2blk (struct vtoc_cchhb *ptr, struct hd_geometry *geo) {
43int 43int
44ibm_partition(struct parsed_partitions *state, struct block_device *bdev) 44ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
45{ 45{
46 int blocksize, offset, size; 46 int blocksize, offset, size,res;
47 loff_t i_size; 47 loff_t i_size;
48 dasd_information_t *info; 48 dasd_information_t *info;
49 struct hd_geometry *geo; 49 struct hd_geometry *geo;
@@ -56,15 +56,16 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
56 unsigned char *data; 56 unsigned char *data;
57 Sector sect; 57 Sector sect;
58 58
59 res = 0;
59 blocksize = bdev_hardsect_size(bdev); 60 blocksize = bdev_hardsect_size(bdev);
60 if (blocksize <= 0) 61 if (blocksize <= 0)
61 return 0; 62 goto out_exit;
62 i_size = i_size_read(bdev->bd_inode); 63 i_size = i_size_read(bdev->bd_inode);
63 if (i_size == 0) 64 if (i_size == 0)
64 return 0; 65 goto out_exit;
65 66
66 if ((info = kmalloc(sizeof(dasd_information_t), GFP_KERNEL)) == NULL) 67 if ((info = kmalloc(sizeof(dasd_information_t), GFP_KERNEL)) == NULL)
67 goto out_noinfo; 68 goto out_exit;
68 if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL) 69 if ((geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL)) == NULL)
69 goto out_nogeo; 70 goto out_nogeo;
70 if ((label = kmalloc(sizeof(union label_t), GFP_KERNEL)) == NULL) 71 if ((label = kmalloc(sizeof(union label_t), GFP_KERNEL)) == NULL)
@@ -72,7 +73,7 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
72 73
73 if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 || 74 if (ioctl_by_bdev(bdev, BIODASDINFO, (unsigned long)info) != 0 ||
74 ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0) 75 ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0)
75 goto out_noioctl; 76 goto out_freeall;
76 77
77 /* 78 /*
78 * Get volume label, extract name and type. 79 * Get volume label, extract name and type.
@@ -92,6 +93,8 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
92 EBCASC(type, 4); 93 EBCASC(type, 4);
93 EBCASC(name, 6); 94 EBCASC(name, 6);
94 95
96 res = 1;
97
95 /* 98 /*
96 * Three different types: CMS1, VOL1 and LNX1/unlabeled 99 * Three different types: CMS1, VOL1 and LNX1/unlabeled
97 */ 100 */
@@ -156,6 +159,9 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
156 counter++; 159 counter++;
157 blk++; 160 blk++;
158 } 161 }
162 if (!data)
163 /* Are we not supposed to report this ? */
164 goto out_readerr;
159 } else { 165 } else {
160 /* 166 /*
161 * Old style LNX1 or unlabeled disk 167 * Old style LNX1 or unlabeled disk
@@ -171,18 +177,17 @@ ibm_partition(struct parsed_partitions *state, struct block_device *bdev)
171 } 177 }
172 178
173 printk("\n"); 179 printk("\n");
174 kfree(label); 180 goto out_freeall;
175 kfree(geo); 181
176 kfree(info);
177 return 1;
178 182
179out_readerr: 183out_readerr:
180out_noioctl: 184 res = -1;
185out_freeall:
181 kfree(label); 186 kfree(label);
182out_nolab: 187out_nolab:
183 kfree(geo); 188 kfree(geo);
184out_nogeo: 189out_nogeo:
185 kfree(info); 190 kfree(info);
186out_noinfo: 191out_exit:
187 return 0; 192 return res;
188} 193}