[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1159350216.25016.107.camel@amol.verismonetworks.com>
Date: Wed, 27 Sep 2006 15:13:36 +0530
From: Amol Lad <amol@...ismonetworks.com>
To: linux kernel <linux-kernel@...r.kernel.org>
Cc: kernel Janitors <kernel-janitors@...ts.osdl.org>
Subject: [PATCH] ioremap balanced with iounmap for drivers/sbus
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Tested (compilation only) with:
- Modifying arch/i386/Kconfig and other Makefiles to make sure that the
changed file is compiling ok.
Signed-off-by: Amol Lad <amol@...ismonetworks.com>
---
vfc_dev.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
---
diff -uprN -X linux-2.6.18-orig/Documentation/dontdiff linux-2.6.18-orig/drivers/sbus/char/vfc_dev.c linux-2.6.18/drivers/sbus/char/vfc_dev.c
--- linux-2.6.18-orig/drivers/sbus/char/vfc_dev.c 2006-09-21 10:15:38.000000000 +0530
+++ linux-2.6.18/drivers/sbus/char/vfc_dev.c 2006-09-27 14:46:59.000000000 +0530
@@ -678,8 +678,14 @@ static int vfc_probe(void)
if (strcmp(sdev->prom_name, "vfc") == 0) {
vfc_dev_lst[instance]=(struct vfc_dev *)
kmalloc(sizeof(struct vfc_dev), GFP_KERNEL);
- if (vfc_dev_lst[instance] == NULL)
+ if (vfc_dev_lst[instance] == NULL) {
+ int i;
+ for (i = 0; i < instance; i++) {
+ if (vfc_dev_lst[i]->regs)
+ sbus_iounmap(vfc_dev_lst[i]->regs, sizeof(struct vfc_regs));
+ }
return -ENOMEM;
+ }
ret = init_vfc_device(sdev,
vfc_dev_lst[instance],
instance);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists