[PATCH] Memory leak in e100

Henrik Thostrup Jensen (htj@antilogic.dk)
Sat, 15 Mar 2003 05:31:09 +0100


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/