kgdb: Removed kmalloc returned value cast
PATCH 1/1 kgdb: Removed kmalloc returned value cast
--- arch/powerpc/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/kgdb.c +1 -1
@@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)if (user_mode (regs))return 0 ; - backup_current_thread_info = (struct thread_info *)kmalloc (sizeof (struct thread_info ),GFP_KERNEL ); + backup_current_thread_info =kmalloc (sizeof (struct thread_info ),GFP_KERNEL );/* * On Book E and perhaps other processors, singlestep is handled on * the critical exception stack. This causes current_thread_info()
Signature · 1 line
1.7.10.4
Quoted 10 lines · Alex Grad
Signed-off-by Alex Grad <[email protected]>--- arch/powerpc/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/kernel/kgdb.c +0
-0
arch/powerpc/kernel/kgdb.c static int kgdb_singlestep(struct pt_regs *regs) · line 162
Quoted 5 lines
arch/powerpc/kernel/kgdb.c +1
-1@@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)if (user_mode (regs))return 0 ; - backup_current_thread_info = (struct thread_info *)kmalloc (sizeof (struct thread_info ),GFP_KERNEL ); + backup_current_thread_info =kmalloc (sizeof (struct thread_info ),GFP_KERNEL );
Looks good to me.
There's two additional problems in the kgdb_singlestep() function: it doesn't check if the kmalloc() call fails nor does it kfree() the allocated memory.
Pekka
Quoted 14 lines · Pekka Enberg
Quoted 13 lines · Alex Grad
Signed-off-by Alex Grad <[email protected]>--- arch/powerpc/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/powerpc/kernel/kgdb.c +0
-0@@ -159,7 +159,7 @@ static int kgdb_singlestep(struct pt_regs *regs)if (user_mode (regs))return 0 ;
Quoted 8 lines
arch/powerpc/kernel/kgdb.c static int kgdb_singlestep(struct pt_regs *regs) · line 162
Quoted 2 lines
arch/powerpc/kernel/kgdb.c +1
-1- backup_current_thread_info = (struct thread_info *)kmalloc (sizeof (struct thread_info ),GFP_KERNEL ); + backup_current_thread_info =kmalloc (sizeof (struct thread_info ),GFP_KERNEL );Looks good to me.
There's two additional problems in the
kgdb_singlestep()function: it doesn't check if thekmalloc()call fails nor does itkfree()the allocated memory.
Hi Pekka,
Indeed there is no check if kmalloc() fails. This should be fixed.
Anyhow, commit fefd9e6f powerpc: kernel/kgdb.c: Fix memory leakage fixed the problem with kfree.
thanks,
Daniel.