Skip to contentSkip to conversation

mtd_debug damaged my rom monitor

PATCH Chen Yaoming 1 participant 1 message Oct 24, 2001 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw
# ./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 Wed Oct 24 11:34:49 2001 renamed from mtd_debug.c.orig Tue Oct 9 06:00:06 2001 +0 -1
@@ -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;
         }