Skip to content

Commit

Permalink
drivers/block/swim3.c: fix null pointer dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cong Ding authored and Jens Axboe committed Feb 22, 2013
1 parent 79d0b7f commit 7414d4f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/block/swim3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 7414d4f

Please sign in to comment.