All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: swim3.c: fix null pointer dereference
@ 2013-01-14 17:20 Cong Ding
  0 siblings, 0 replies; only message in thread
From: Cong Ding @ 2013-01-14 17:20 UTC (permalink / raw)
  To: Andrew Morton, Greg Kroah-Hartman, Kent Overstreet, linux-kernel
  Cc: Cong Ding

the use if pointer fs should be after the null check.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
 drivers/block/swim3.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index d889f95..deb722d 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;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-14 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 17:20 [PATCH] block: swim3.c: fix null pointer dereference Cong Ding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.