From: Roel Kluin Date: Thu, 4 Jun 2009 23:57:24 +0000 (-0400) Subject: Blackfin: fix length checking in kgdb_ebin2mem X-Git-Tag: v2.6.31-rc1~361^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a990614264f04879d9608da1cfcf9a6596efe08;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 Signed-off-by: Mike Frysinger --- diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c index c5362b2..da28f79 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) unsigned short *mmr16; unsigned long *mmr32; int err; - int size = 0; + int size; int cpu = raw_smp_processor_id(); tmp_old = tmp_new = buf; - while (count-- > 0) { + for (size = 0; size < count; ++size) { if (*tmp_old == 0x7d) *tmp_new = *(++tmp_old) ^ 0x20; else *tmp_new = *tmp_old; tmp_new++; tmp_old++; - size++; } err = validate_memory_access_address((unsigned long)mem, size);