public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Steve Wahl <swahl@brecis.COM>
To: linux-mtd@lists.infradead.org
Subject: Possible bug in /proc/mtd ?
Date: Wed, 6 Mar 2002 09:44:31 -0600	[thread overview]
Message-ID: <20020306094431.C15112@brecis.com> (raw)

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

             reply	other threads:[~2002-03-06 15:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-06 15:44 Steve Wahl [this message]
2002-03-07 18:25 ` Possible bug in /proc/mtd ? Jörn Engel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020306094431.C15112@brecis.com \
    --to=swahl@brecis.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox