2003-03-15 04:17:40

by Henrik Thostrup Jensen

[permalink] [raw]
Subject: [PATCH] Memory leak in e100

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


2003-03-17 03:19:52

by Feldman, Scott

[permalink] [raw]
Subject: RE: [PATCH] Memory leak in e100

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

Ack, thanks.

I'll add this to the other e100 patches I'm sending Jeff.

-scott