diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-06-04 19:57:24 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-06-12 06:12:07 -0400 |
commit | 0a990614264f04879d9608da1cfcf9a6596efe08 (patch) | |
tree | e4f10199fd1ab998b479fd3395a86b55d68b874d /arch/blackfin | |
parent | 11aca0e7352b6a28193221cd2dd85f758fb71b23 (diff) |
Blackfin: fix length checking in kgdb_ebin2mem
The kgdb_ebin2mem() was decrementing the count variable to do parsing, but
then later still tries to use it based on its original meaning. So leave
it untouched and use a different variable to walk the memory.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/kernel/kgdb.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c index c5362b2b9ed1..da28f796ad78 100644 --- a/arch/blackfin/kernel/kgdb.c +++ b/arch/blackfin/kernel/kgdb.c | |||
@@ -587,19 +587,18 @@ int kgdb_ebin2mem(char *buf, char *mem, int count) | |||
587 | unsigned short *mmr16; | 587 | unsigned short *mmr16; |
588 | unsigned long *mmr32; | 588 | unsigned long *mmr32; |
589 | int err; | 589 | int err; |
590 | int size = 0; | 590 | int size; |
591 | int cpu = raw_smp_processor_id(); | 591 | int cpu = raw_smp_processor_id(); |
592 | 592 | ||
593 | tmp_old = tmp_new = buf; | 593 | tmp_old = tmp_new = buf; |
594 | 594 | ||
595 | while (count-- > 0) { | 595 | for (size = 0; size < count; ++size) { |
596 | if (*tmp_old == 0x7d) | 596 | if (*tmp_old == 0x7d) |
597 | *tmp_new = *(++tmp_old) ^ 0x20; | 597 | *tmp_new = *(++tmp_old) ^ 0x20; |
598 | else | 598 | else |
599 | *tmp_new = *tmp_old; | 599 | *tmp_new = *tmp_old; |
600 | tmp_new++; | 600 | tmp_new++; |
601 | tmp_old++; | 601 | tmp_old++; |
602 | size++; | ||
603 | } | 602 | } |
604 | 603 | ||
605 | err = validate_memory_access_address((unsigned long)mem, size); | 604 | err = validate_memory_access_address((unsigned long)mem, size); |