Make sure that argv[] argument pointers are not modified.The hush shell dynamically allocates (and re-allocates) memory for theargument strings in the "char *argv[]" argument vector passed tocomm
Make sure that argv[] argument pointers are not modified.The hush shell dynamically allocates (and re-allocates) memory for theargument strings in the "char *argv[]" argument vector passed tocommands. Any code that modifies these pointers will cause seriouscorruption of the malloc data structures and crash U-Boot, so makesure the compiler can check that no such modifications are being doneby changing the code into "char * const argv[]".This modification is the result of debugging a strange crash causedafter adding a new command, which used the following argumentprocessing code which has been working perfectly fine in all Unixsystems since version 6 - but not so in U-Boot:int main (int argc, char **argv){ while (--argc > 0 && **++argv == '-') {/* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ...}The line marked "====>" will corrupt the malloc data structures andusually cause U-Boot to crash when the next command gets executed bythe shell. With the modification, the compiler will prevent this withan error: increment of read-only location '*argv'N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ...Signed-off-by: Wolfgang Denk <wd@denx.de>Acked-by: Mike Frysinger <vapier@gentoo.org>
show more ...
m68k: Move cpu/$CPU to arch/m68k/cpu/$CPUSigned-off-by: Peter Tyser <ptyser@xes-inc.com>
12