Commit b09ece0836e0267b86f37defec267aa3806cb03a

Authored by Alexandru Gagniuc
Committed by Tom Rini
1 parent 306b236bc1

common/xyzModem.c: Do not use hard-coded address for debug buffer

Under the plethora of #ifdefs, the xyzModem code hid this pearl:
static char *zm_out = (char *) 0x00380000;
This was only enabled when DEBUG is defined, so it's probably why it
went unnoticed for so long. No idea what platform had memory at that
exact location, but the this approach is extremely hacky.
Use a static buffer instead.

Signed-off-by: Alexandru Gagniuc <alex.g@adaptrum.com>

Showing 1 changed file with 3 additions and 9 deletions Side-by-side Diff

... ... @@ -176,16 +176,10 @@
176 176 /*
177 177 * Note: this debug setup works by storing the strings in a fixed buffer
178 178 */
179   -#define FINAL
180   -#ifdef FINAL
181   -static char *zm_out = (char *) 0x00380000;
182   -static char *zm_out_start = (char *) 0x00380000;
183   -#else
184   -static char zm_buf[8192];
185   -static char *zm_out = zm_buf;
186   -static char *zm_out_start = zm_buf;
  179 +static char zm_debug_buf[8192];
  180 +static char *zm_out = zm_debug_buf;
  181 +static char *zm_out_start = zm_debug_buf;
187 182  
188   -#endif
189 183 static int
190 184 zm_dprintf (char *fmt, ...)
191 185 {