u-boot/drivers
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
..
bios_emulator ati_radeon: Support PCI virtual not eq bus mapping. 2010-04-08 15:30:47 +02:00
block 85xx/fsl-sata: Use is_serdes_configured() to determine if SATA is enabled 2010-05-12 04:53:51 -05:00
dma ColdFire: Fix compile warning messages 2009-08-26 03:44:31 -05:00
fpga add block write function to spartan3 slave serial load 2010-03-24 11:08:43 -05:00
gpio Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
hwmon Misc ds1722 fixups 2009-09-04 21:54:52 +02:00
i2c Blackfin: TWI/I2C: implement multibus support 2010-05-05 10:04:38 +02:00
input mpc5xxx: Remove all references to MGT5100 2010-03-21 22:44:42 +01:00
misc Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
mmc PXA: PXAMMC: Add Monahans support 2010-06-13 13:39:11 +02:00
mtd sf: move useful messages from debug to printf 2010-06-30 23:47:08 -04:00
net tsec: Fix eTSEC2 link problem on P2020RDB 2010-06-29 23:03:23 +02:00
pci Move arch/ppc to arch/powerpc 2010-04-21 23:42:38 +02:00
pcmcia Misc ti_pci1410a fixups 2009-09-04 21:54:04 +02:00
power OMAP3 Move twl4030 mmc function 2009-07-29 09:57:43 +02:00
qe Make sure that argv[] argument pointers are not modified. 2010-07-04 23:55:42 +02:00
rtc Remove AmigaOneG3SE board 2010-06-23 23:24:20 +02:00
serial Add Orion5x support to 16550 device driver 2010-06-17 19:37:01 +05:30
spi Davinci: SPI performance enhancements 2010-06-22 11:06:01 -04:00
twserial drivers/twserial: Add protocol driver for "three wire serial" interface. 2009-03-30 09:38:36 +02:00
usb drivers/usb/host/ohci-hcd: rename readl/writel to ohci_readl/ohci_writel 2010-06-30 21:38:10 +02:00
video video: sm501.c: add weak default functions 2010-06-14 12:29:34 +02:00
watchdog Convert at91 watchdog driver to new SoC access 2010-04-03 15:24:27 -05:00