Skip to contentSkip to conversation

block: swim3.c: fix null pointer dereference

PATCH New Cong Ding 1 participant 1 message Jan 14, 2013 Block layer

lore
Share & tools
lore

Cong Ding

author
#0 lore raw

PATCH 1/1 block: swim3.c: fix null pointer dereference

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

---
 drivers/block/swim3.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/swim3.c +4 -1
index d889f95..deb722d 100644
@@ -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;
 
Signature · 1 line
1.7.9.5