public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* mtd_debug damaged my rom monitor
@ 2001-10-24  5:10 Chen Yaoming
  0 siblings, 0 replies; 2+ messages in thread
From: Chen Yaoming @ 2001-10-24  5:10 UTC (permalink / raw)
  To: linux-mtd

# ./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;
         }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* mtd_debug damaged my rom monitor
@ 2001-10-24  5:12 Chen Yaoming
  0 siblings, 0 replies; 2+ messages in thread
From: Chen Yaoming @ 2001-10-24  5:12 UTC (permalink / raw)
  To: linux-mtd

# ./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;
         }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-10-24  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-10-24  5:10 mtd_debug damaged my rom monitor Chen Yaoming
  -- strict thread matches above, loose matches on Subject: below --
2001-10-24  5:12 Chen Yaoming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox