diff options
Diffstat (limited to 'kernel/kgdb.c')
-rw-r--r-- | kernel/kgdb.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 761fdd2b3034..42fd128127a6 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -391,27 +391,22 @@ int kgdb_mem2hex(char *mem, char *buf, int count) | |||
391 | 391 | ||
392 | /* | 392 | /* |
393 | * Copy the binary array pointed to by buf into mem. Fix $, #, and | 393 | * Copy the binary array pointed to by buf into mem. Fix $, #, and |
394 | * 0x7d escaped with 0x7d. Return a pointer to the character after | 394 | * 0x7d escaped with 0x7d. Return -EFAULT on failure or 0 on success. |
395 | * the last byte written. | 395 | * The input buf is overwitten with the result to write to mem. |
396 | */ | 396 | */ |
397 | static int kgdb_ebin2mem(char *buf, char *mem, int count) | 397 | static int kgdb_ebin2mem(char *buf, char *mem, int count) |
398 | { | 398 | { |
399 | int err = 0; | 399 | int size = 0; |
400 | char c; | 400 | char *c = buf; |
401 | 401 | ||
402 | while (count-- > 0) { | 402 | while (count-- > 0) { |
403 | c = *buf++; | 403 | c[size] = *buf++; |
404 | if (c == 0x7d) | 404 | if (c[size] == 0x7d) |
405 | c = *buf++ ^ 0x20; | 405 | c[size] = *buf++ ^ 0x20; |
406 | 406 | size++; | |
407 | err = probe_kernel_write(mem, &c, 1); | ||
408 | if (err) | ||
409 | break; | ||
410 | |||
411 | mem++; | ||
412 | } | 407 | } |
413 | 408 | ||
414 | return err; | 409 | return probe_kernel_write(mem, c, size); |
415 | } | 410 | } |
416 | 411 | ||
417 | /* | 412 | /* |