* [PATCH 4/4] arch/xtensa/kernel/process.c: take size of pointed value, not pointer
@ 2011-09-16 6:57 Julia Lawall
0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2011-09-16 6:57 UTC (permalink / raw)
To: Chris Zankel
Cc: kernel-janitors, Andrew Morton, Eric Dumazet, Mike Frysinger,
Arun Sharma, linux-kernel
From: Julia Lawall <julia@diku.dk>
Sizeof a pointer-typed expression returns the size of the pointer, not that
of the pointed data.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression *e;
type T;
identifier f;
@@
f(...,(T)e,...,
-sizeof(e)
+sizeof(*e)
,...)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
arch/xtensa/kernel/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -277,7 +277,7 @@ void xtensa_elf_core_copy_regs (xtensa_g
/* Don't leak any random bits. */
- memset(elfregs, 0, sizeof (elfregs));
+ memset(elfregs, 0, sizeof(*elfregs));
/* Note: PS.EXCM is not set while user task is running; its
* being set in regs->ps is for exception handling convenience.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-09-16 6:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-16 6:57 [PATCH 4/4] arch/xtensa/kernel/process.c: take size of pointed value, not pointer Julia Lawall
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®