mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Henrik Thostrup Jensen <htj@antilogic.dk>
To: scott.feldman@intel.com, linux-kernel@vger.kernel.org
Subject: [PATCH] Memory leak in e100
Date: Sat, 15 Mar 2003 05:31:09 +0100	[thread overview]
Message-ID: <20030315053109.63cdb6cb.htj@antilogic.dk> (raw)

Hi

This patch fixed a memory leak in the e100 driver.
Leak was catched by smatch.

Best regards, Henrik


Please cc, as I'm not subscribed.


diff -u -r1.35 e100_main.c
--- linux/drivers/net/e100/e100_main.c	3 Mar 2003 04:36:31 -0000
+++ linux/drivers/net/e100/e100_main.c	15 Mar 2003 03:07:31 -0000
@@ -3744,6 +3744,7 @@
 	char *strings = NULL;
 	char *usr_strings;
 	int i;
+	int rc = 0;
 
 	memset((void *) &info, 0, sizeof(info));
 
@@ -3784,14 +3785,19 @@
 		return -EOPNOTSUPP;
 	}
 
-	if (copy_to_user(ifr->ifr_data, &info, sizeof (info)))
-		return -EFAULT;
+	if (copy_to_user(ifr->ifr_data, &info, sizeof (info))) {
+		rc = -EFAULT;
+		goto exit3;
+	}
 
-	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN))
-		return -EFAULT;
+	if (copy_to_user(usr_strings, strings, info.len * ETH_GSTRING_LEN)) {
+		rc = -EFAULT;
+		goto exit3;
+	}
 
+exit3:
 	kfree(strings);
-	return 0;
+	return rc;
 }
 
 static int

             reply	other threads:[~2003-03-15  4:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-15  4:31 Henrik Thostrup Jensen [this message]
2003-03-17  3:30 Feldman, Scott

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=20030315053109.63cdb6cb.htj@antilogic.dk \
    --to=htj@antilogic.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scott.feldman@intel.com \
    /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®