Patchwork [3/5] kernel,debug: SPARC KGDB stub strcpy fix

login
register
mail settings
Submitter Konrad Eisele
Date Oct. 11, 2011, 12:19 p.m.
Message ID <1318335600-25561-1-git-send-email-konrad@gaisler.com>
Download mbox | patch
Permalink /patch/118979/
State Superseded
Delegated to: David Miller
Headers show

Comments

Konrad Eisele - Oct. 11, 2011, 12:19 p.m.
Works aroung the fact that strcpy with a constant string is
converted to memcpy by gcc and that  memcpy in SPARC returns 0.

Signed-off-by: Konrad Eisele <konrad@gaisler.com>
---
 kernel/debug/gdbstub.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index a11db95..380753e 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -946,7 +946,8 @@  int gdb_serial_stub(struct kgdb_state *ks)
 		ptr = remcom_out_buffer;
 		*ptr++ = 'T';
 		ptr = pack_hex_byte(ptr, ks->signo);
-		ptr += strlen(strcpy(ptr, "thread:"));
+		strcpy(ptr, "thread:");
+		ptr += strlen(ptr);
 		int_to_threadref(thref, shadow_pid(current->pid));
 		ptr = pack_threadid(ptr, thref);
 		*ptr++ = ';';