mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/net/sunhme.c, unbalanced and unchecked ioremap()
@ 2001-02-22  9:11 Andrey Panin
  2001-02-22 10:32 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Panin @ 2001-02-22  9:11 UTC (permalink / raw)
  To: linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 391 bytes --]


Hi all,

I found that sunhme.c doesn't check ioremap() return value and doesn't
call iounmap() on module unload. Attached patch (for 2.4.1-ac20) should fix it, 
compiles clearly, but untested (I have no such hardware).

Best regards.

-- 
Andrey Panin            | Embedded systems software engineer
pazke@orbita1.ru        | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc

[-- Attachment #1.2: patch-ioremap-sunhme --]
[-- Type: text/plain, Size: 799 bytes --]

diff -ur linux.vanilla/drivers/net/sunhme.c linux/drivers/net/sunhme.c
--- linux.vanilla/drivers/net/sunhme.c	Thu Feb 22 20:50:00 2001
+++ linux/drivers/net/sunhme.c	Thu Feb 22 22:00:43 2001
@@ -2856,7 +2856,10 @@
 		printk(KERN_ERR "happymeal(PCI): Cannot find proper PCI device base address.\n");
 		return -ENODEV;
 	}
-	hpreg_base = (unsigned long) ioremap(hpreg_base, 0x8000);
+	if ((hpreg_base = (unsigned long) ioremap(hpreg_base, 0x8000)) == 0) {
+		printk(KERN_ERR "happymeal(PCI): Unable to remap card memory.\n");
+		return -ENODEV;
+	}
 
 	for (i = 0; i < 6; i++) {
 		if (macaddr[i] != 0)
@@ -3071,6 +3074,7 @@
 					    PAGE_SIZE,
 					    hp->happy_block,
 					    hp->hblock_dvma);
+			iounmap((void *)hp->gregs);
 		}
 #endif
 		unregister_netdev(hp->dev);

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-02-22 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-22  9:11 [PATCH] drivers/net/sunhme.c, unbalanced and unchecked ioremap() Andrey Panin
2001-02-22 10:32 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®