uboot/board/freescale
Wolfgang Denk 54841ab50c Make sure that argv[] argument pointers are not modified.
The hush shell dynamically allocates (and re-allocates) memory for the
argument strings in the "char *argv[]" argument vector passed to
commands.  Any code that modifies these pointers will cause serious
corruption of the malloc data structures and crash U-Boot, so make
sure the compiler can check that no such modifications are being done
by changing the code into "char * const argv[]".

This modification is the result of debugging a strange crash caused
after adding a new command, which used the following argument
processing code which has been working perfectly fine in all Unix
systems 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 and
usually cause U-Boot to crash when the next command gets executed by
the shell.  With the modification, the compiler will prevent this with
an
	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>
2010-07-04 23:55:42 +02:00
..
common Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
m547xevb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m548xevb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5208evbe m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5235evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5249evb Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
m5253demo m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5253evbe m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5271evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5272c3 m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5275evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5282evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5329evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m5373evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m52277evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m53017evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m54451evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
m54455evb m68k: Move cpu/$CPU to arch/m68k/cpu/$CPU 2010-04-13 09:13:24 +02:00
mpc832xemds
mpc837xemds ppc: Split MPC83xx SERDES code from MPC85xx/MPC86xx/QorIQ 2010-04-26 22:37:57 -05:00
mpc837xerdb ppc: Split MPC83xx SERDES code from MPC85xx/MPC86xx/QorIQ 2010-04-26 22:37:57 -05:00
mpc5121ads
mpc7448hpc2 Move arch/ppc to arch/powerpc 2010-04-21 23:42:38 +02:00
mpc8260ads
mpc8266ads
mpc8313erdb
mpc8315erdb mpc83xx: Add NAND boot support for MPC8315E-RDB boards 2010-01-07 18:33:52 -06:00
mpc8323erdb
mpc8349emds
mpc8349itx
mpc8360emds 83xx, uec: split enet_interface in two variables 2010-01-31 22:37:12 -08:00
mpc8360erdk
mpc8536ds 85xx/fsl-sata: Use is_serdes_configured() to determine if SATA is enabled 2010-05-12 04:53:51 -05:00
mpc8540ads
mpc8541cds
mpc8544ds fsl: improve the PIXIS code and fix a few bugs 2010-04-07 00:21:27 -05:00
mpc8548cds PCIe, USB: Replace 'end point' references with 'endpoint' 2010-01-17 23:06:44 +01:00
mpc8555cds
mpc8560ads
mpc8568mds PCIe, USB: Replace 'end point' references with 'endpoint' 2010-01-17 23:06:44 +01:00
mpc8569mds Create CPUDIR variable 2010-04-13 09:12:59 +02:00
mpc8572ds fsl: improve the PIXIS code and fix a few bugs 2010-04-07 00:21:27 -05:00
mpc8610hpcd Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
mpc8641hpcn Move arch/ppc to arch/powerpc 2010-04-21 23:42:38 +02:00
mx31ads arm: Move cpu/$CPU to arch/arm/cpu/$CPU 2010-04-13 09:13:24 +02:00
mx31pdk
mx51evk Add SPI support to mx51evk board 2010-05-05 09:48:41 +02:00
p1_p2_rdb 85xx/p1_p2_rdb: Added RevD board version support 2010-06-29 21:07:26 +02:00
p2020ds p2020ds: add alternate boot bank support using the ngPIXIS FPGA 2010-04-07 00:21:28 -05:00