mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Panin <pazke@orbita.don.sitek.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] drivers/net/sunhme.c, unbalanced and unchecked ioremap()
Date: Thu, 22 Feb 2001 12:11:51 +0300	[thread overview]
Message-ID: <20010222121151.A13350@orbita1.ru> (raw)


[-- 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 --]

             reply	other threads:[~2001-02-22  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-22  9:11 Andrey Panin [this message]
2001-02-22 10:32 ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010222121151.A13350@orbita1.ru \
    --to=pazke@orbita.don.sitek.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®