diff options
author | Julia Lawall <julia@diku.dk> | 2009-08-23 12:09:05 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-08-23 12:10:00 -0400 |
commit | cf05b824dbb871159e1b4c4f2733b9c9d2f756cf (patch) | |
tree | 0fa55852038849722150149da4ab418f96c945b3 /drivers/s390/block/dasd.c | |
parent | 06739a8ad321b1e5140b318c648b0cc4bf8c6daa (diff) |
[S390] drivers/s390: put NULL test before dereference
If the NULL test on block is needed, it should be before the dereference of
the base field.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
expression E1,E2;
identifier fld;
statement S1,S2;
@@
E1 = E2->fld;
(
if (E1 == NULL) S1 else S2
|
*if (E2 == NULL) S1 else S2
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd.c')
-rw-r--r-- | drivers/s390/block/dasd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 749836668655..3f62dd50bbbe 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2135,9 +2135,9 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
2135 | struct dasd_device *base; | 2135 | struct dasd_device *base; |
2136 | 2136 | ||
2137 | block = bdev->bd_disk->private_data; | 2137 | block = bdev->bd_disk->private_data; |
2138 | base = block->base; | ||
2139 | if (!block) | 2138 | if (!block) |
2140 | return -ENODEV; | 2139 | return -ENODEV; |
2140 | base = block->base; | ||
2141 | 2141 | ||
2142 | if (!base->discipline || | 2142 | if (!base->discipline || |
2143 | !base->discipline->fill_geometry) | 2143 | !base->discipline->fill_geometry) |