Skip to content
Snippets Groups Projects
  1. Jul 04, 2010
    • Wolfgang Denk's avatar
      Make sure that argv[] argument pointers are not modified. · 54841ab5
      Wolfgang Denk authored
      
      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: default avatarWolfgang Denk <wd@denx.de>
      Acked-by: default avatarMike Frysinger <vapier@gentoo.org>
      54841ab5
  2. Apr 21, 2010
  3. Apr 13, 2010
  4. Jul 20, 2009
  5. Oct 18, 2008
  6. Mar 31, 2006
  7. Jul 24, 2003
  8. Jun 27, 2003
    • Wolfgang Denk's avatar
      * Code cleanup: · 8bde7f77
      Wolfgang Denk authored
        - remove trailing white space, trailing empty lines, C++ comments, etc.
        - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)
      
      * Patches by Kenneth Johansson, 25 Jun 2003:
        - major rework of command structure
          (work done mostly by Michal Cendrowski and Joakim Kristiansen)
      8bde7f77
  9. Apr 05, 2003
    • Wolfgang Denk's avatar
      * Patch by Arun Dharankar, 4 Apr 2003: · 3e38691e
      Wolfgang Denk authored
        Add IDMA example code (tested on 8260 only)
      
      * Add support for Purple Board (MIPS64 5Kc)
      
      * Add support for MIPS64 5Kc CPUs
      
      * Fix missing setting of "loadaddr" and "bootfile" on ARM and MIPS
      
      * Patch by Denis Peter, 04 Apr 2003:
        - update MIP405-4 board
      
      * Patches by Denis Peter, 03 April 2003:
        - fix PCI IRQs on MPL boards
        - fix two more un-relocated pointer problems
      
      * Fix behaviour of "run" command:
        - print error message iv variable does not exist
        - terminate processing of arguments in case of error
      
      * Patches by Peter Figuli, 10 Mar 2003
        - Add support for BTUART on PXA platform
        - Add support for WEP EP250 (PXA) board
      
      * Fix flash problems on INCA-IP; add tool to allow bruning images  to
        flash using a BDI2000
      
      * Implement fix for I2C Edge Conditions problem for all boards that
        use the bit-banging driver (common/soft_i2c.c)
      
      * Add patches by Robert Schwebel, 31 Mar 2003:
        - csb226 board: bring in sync with innokom/memsetup.S
        - csb226 board: fix MDREFR handling
        - misc doc fixes / extensions
        - innokom board: cleanup, MDREFR fix in memsetup.S, config update
        - add BOOT_PROGRESS to armlinux.c
      3e38691e
Loading