[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0912061015030.20858@ask.diku.dk>
Date: Sun, 6 Dec 2009 10:15:32 +0100 (CET)
From: Julia Lawall <julia@...u.dk>
To: Chris Zankel <chris@...kel.net>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH 1/5] arch/xtensa/platforms/iss: correct size computation
From: Julia Lawall <julia@...u.dk>
The size argument to alloc_bootmem should be the size of desired structure,
not the pointer to it.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@expression@
expression *x;
@@
x =
<+...
-sizeof(x)
+sizeof(*x)
...+>// </smpl>
Signed-off-by: Julia Lawall <julia@...u.dk>
---
arch/xtensa/platforms/iss/network.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 2f0b86b..54a0868 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -780,7 +780,8 @@ static int iss_net_setup(char *str)
return 1;
}
- if ((new = alloc_bootmem(sizeof new)) == NULL) {
+ new = alloc_bootmem(sizeof(*new));
+ if (new == NULL) {
printk("Alloc_bootmem failed\n");
return 1;
}
--
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