From: Cong Ding Date: Wed, 20 Feb 2013 02:13:52 +0000 (+1100) Subject: drivers/block/swim3.c: fix null pointer dereference X-Git-Tag: next-20130220~1^2~612 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=c8e2f2f6dd7668f41fcd77ac1d31cd21a8a6fdfe;p=karo-tx-linux.git drivers/block/swim3.c: fix null pointer dereference The use of pointer fs should be after the null check. Signed-off-by: Cong Ding Cc: Jens Axboe Signed-off-by: Andrew Morton --- 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;