Possible bug in /proc/mtd ?
Steve Wahl
swahl at brecis.COM
Wed Mar 6 10:44:31 EST 2002
I've just started to bring up MTD in a uC-linux derived system.
I've found what I believe is a problem in the code for /proc/mtd.
Does anyone else get some sort of strange behavior if they run:
dd if=/proc/mtd of=/dev/tty bs=1
The strange behavior on my system is a hang; it may be an oops or
panic of some sort on a system with a mmu.
If you see this problem, I think it should go away with this patch:
------------------------------------------------------------
--- mtdcore.c 22 Nov 2001 05:29:30 -0000 1.2
+++ mtdcore.c 6 Mar 2002 15:40:55 -0000
@@ -289,21 +289,21 @@
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
*eof = 1;
#endif
done:
up(&mtd_table_mutex);
if (off >= len+begin)
return 0;
- *start = page + (begin-off);
+ *start = page + (off-begin);
return ((count < begin+len-off) ? count : begin+len-off);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)
struct proc_dir_entry mtd_proc_entry = {
0, /* low_ino: the inode -- dynamic */
3, "mtd", /* len of name and name */
S_IFREG | S_IRUGO, /* mode */
1, 0, 0, /* nlinks, owner, group */
0, NULL, /* size - unused; operations -- use default */
------------------------------------------------------------
Thanks for looking,
--> Steve Wahl
More information about the linux-mtd
mailing list