Skip to contentSkip to conversation

] POWERPC: fix memset size error

PATCH In review Li Zefan 2 participants 2 messages Nov 5, 2007 PowerPC

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 3/6 ] POWERPC: fix memset size error

The size passing to memset is wrong.

Signed-off-by Li Zefan <[email protected]>

---
 arch/powerpc/kernel/prom_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/prom_init.c +1 -1
index 1db10f7..1add6ef 100644
@@ -1244,7 +1244,7 @@ static void __init prom_initialize_tce_table(void)
 			local_alloc_bottom = base;
 
 		/* It seems OF doesn't null-terminate the path :-( */
-		memset(path, 0, sizeof(path));
+		memset(path, 0, PROM_SCRATCH_SIZE);
 		/* Call OF to setup the TCE hardware */
 		if (call_prom("package-to-path", 3, 1, node,
 			      path, PROM_SCRATCH_SIZE-1) == PROM_ERROR) {
Signature · 1 line
1.5.3.rc7
Acked-by on v1 3/6
#1 lore raw
Quoted 3 lines · Li Zefan

The size passing to memset is wrong.

Signed-off-by Li Zefan <[email protected]>

Good catch, looks like a remain of when path was an array on the stack.

Thanks !

Quoted 18 lines
---
 arch/powerpc/kernel/prom_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/prom_init.c +1 -1
index 1db10f7..1add6ef 100644
@@ -1244,7 +1244,7 @@ static void __init prom_initialize_tce_table(void)
 			local_alloc_bottom = base;
 
 		/* It seems OF doesn't null-terminate the path :-( */
-		memset(path, 0, sizeof(path));
+		memset(path, 0, PROM_SCRATCH_SIZE);
 		/* Call OF to setup the TCE hardware */
 		if (call_prom("package-to-path", 3, 1, node,
 			      path, PROM_SCRATCH_SIZE-1) == PROM_ERROR) {