Blackfin: fix length checking in kgdb_ebin2mem

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, June 12, 2009 - 2:00 pm

Gitweb:     http://git.kernel.org/linus/0a990614264f04879d9608da1cfcf9a6596efe08
Commit:     0a990614264f04879d9608da1cfcf9a6596efe08
Parent:     11aca0e7352b6a28193221cd2dd85f758fb71b23
Author:     Roel Kluin <roel.kluin@gmail.com>
AuthorDate: Thu Jun 4 19:57:24 2009 -0400
Committer:  Mike Frysinger <vapier@gentoo.org>
CommitDate: Fri Jun 12 06:12:07 2009 -0400

    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>
---
 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 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);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Blackfin: fix length checking in kgdb_ebin2mem, Linux Kernel Mailing ..., (Fri Jun 12, 2:00 pm)