Skip to contentSkip to conversation

common/image.c: Relocate strings in tables.

PATCH RESEND New Scott Wood 2 participants 2 messages Apr 2, 2009 – Apr 4, 2009

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH RESEND 1/1 common/image.c: Relocate strings in tables.

Without this, u-boot can crash or print garbage if the original link address no longer points to a valid string.

---
I sent this a couple weeks ago hoping to make it in as a bugfix, but it didn't make it. Do you have any objections to the patch, or can it go in this merge window?

Sent again with the proper list address; apologies to Wolfgang for the duplicate.

 common/image.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
common/image.c +6 -2
index daa68bc..e22c974 100644
@@ -518,7 +518,11 @@ static char *get_table_entry_name (table_entry_t *table, char *msg, int id)
 {
 	for (; table->id >= 0; ++table) {
 		if (table->id == id)
-			return (table->lname);
+#ifdef USE_HOSTCC
+			return table->lname;
+#else
+			return table->lname + gd->reloc_off;
+#endif
 	}
 	return (msg);
 }
@@ -579,7 +583,7 @@ static int get_table_entry_id (table_entry_t *table,
 	fprintf (stderr, "\n");
 #else
 	for (t = table; t->id >= 0; ++t) {
-		if (t->sname && strcmp(t->sname, name) == 0)
+		if (t->sname && strcmp(t->sname + gd->reloc_off, name) == 0)
 			return (t->id);
 	}
 	debug ("Invalid %s Type: %s\n", table_name, name);
Signature · 1 line
1.5.3
#1 lore raw

PATCH RESEND 1/1 common/image.c: Relocate strings in tables.

Dear Scott Wood,

Quoted 9 lines · In message <[email protected]> you wrote:

Without this, u-boot can crash or print garbage if the original link address no longer points to a valid string.

---
I sent this a couple weeks ago hoping to make it in as a bugfix, but it didn't make it. Do you have any objections to the patch, or can it go in this merge window?

Quoted 5 lines

Sent again with the proper list address; apologies to Wolfgang for the duplicate.

 common/image.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How long does it take a  DEC  field  service  engineer  to  change  a
lightbulb?       It depends on how many bad ones he brought with him.