mtd_debug damaged my rom monitor

Chen Yaoming ming at ocdtt.com
Wed Oct 24 01:10:40 EDT 2001


# ./mtd_debug write /dev/mtd0 0x100000 16 /boot/vmlinuz

The command above damaged my rom monitor at FLASH offset 0.
Actually the code in mtd_debug.c can't recognize hex digital due to its
the string to digital conversion
functions called is atol(). I think it should be strtol() as in erase.c
to reach the versatility.

Here is the patch.

--- mtd_debug.c.orig    Tue Oct  9 06:00:06 2001
+++ mtd_debug.c Wed Oct 24 11:34:49 2001
@@ -386,13 +386,13 @@
                showinfo (fd);
                break;
          case OPT_READ:
-               err = flash_to_file (fd,atol (argv[3]),atol
(argv[4]),argv[5]);
+               err = flash_to_file (fd,strtol (argv[3],NULL,0),strtol
(argv[4],NULL,0),argv[5]);
                break;
          case OPT_WRITE:
-               err = file_to_flash (fd,atol (argv[3]),atol
(argv[4]),argv[5]);
+               err = file_to_flash (fd,strtol (argv[3],NULL,0),strtol
(argv[4],NULL,0),argv[5]);
                break;
          case OPT_ERASE:
-               err = erase_flash (fd,atol (argv[3]),atol (argv[4]));
+               err = erase_flash (fd,strtol (argv[3],NULL,0),strtol
(argv[4],NULL,0));
                break;
         }





More information about the linux-mtd mailing list