]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/block/swim3.c: fix null pointer dereference
authorCong Ding <dinggnu@gmail.com>
Thu, 7 Feb 2013 01:26:04 +0000 (12:26 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:46:12 +0000 (16:46 +1100)
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>
drivers/block/swim3.c

index 57763c54363aaf18a03f44464c7496f1c0fd4232..758f2ac878cfe5bfc8f5c891f5f0a48cc4b2e3fd 100644 (file)
@@ -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;