summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorCong Ding <dinggnu@gmail.com>2013-02-21 15:16:40 -0800
committerJens Axboe <axboe@kernel.dk>2013-02-22 10:42:46 +0100
commit7414d4f64b73cc30c600b4fe0a9cbc24cedc4285 (patch)
treec84ba1bbe4809c6271bf0d142fd885d3776f01e9 /drivers/block
parent79d0b7f0e30e803061aa1660602a94c118c0c293 (diff)
drivers/block/swim3.c: fix null pointer dereference
The use of pointer fs should be after the null check. Signed-off-by: Cong Ding <dinggnu@gmail.com> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/swim3.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 57763c54363a..758f2ac878cf 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -1090,10 +1090,13 @@ static const struct block_device_operations floppy_fops = {
static void swim3_mb_event(struct macio_dev* mdev, int mb_state)
{
struct floppy_state *fs = macio_get_drvdata(mdev);
- struct swim3 __iomem *sw = fs->swim3;
+ struct swim3 __iomem *sw;
if (!fs)
return;
+
+ sw = fs->swim3;
+
if (mb_state != MB_FD)
return;