public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "K.F.J. Martens" <kmartens@sonologic.nl>
To: linux-mtd@lists.infradead.org
Cc: dwmw2@redhat.com, trivial@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: [PATCH] Bug in 2.6.10 mtd driver for physmem mapped flash chips
Date: Mon, 27 Dec 2004 16:20:54 +0100	[thread overview]
Message-ID: <20041227152054.GA14835@metro.cx> (raw)


The patch below fixes a small but fatal bug in the code that handles
non-buswidth-aligned writes. The problem is that the code used the same
index in both map_word and buf, therefore putting the wrong words in the
map_word that partially contains old data and partially contains new
data. The result: corrupt data is being written.

Signed-off-by: Koen Martens <kmartens@sonologic.nl>

--- linux-2.6.10/include/linux/mtd/map.h        2004-12-24 22:34:31.000000000 +0100
+++ linux-2.6.10-gmc/include/linux/mtd/map.h    2004-12-27 15:59:02.631211329 +0100
@@ -322,7 +322,7 @@ static inline map_word map_word_load_par
                        bitpos = (map_bankwidth(map)-1-i)*8;
 #endif
                        orig.x[0] &= ~(0xff << bitpos);
-                       orig.x[0] |= buf[i] << bitpos;
+                       orig.x[0] |= buf[i-start] << bitpos;
                }
        }
        return orig;

-- 
K.F.J. Martens, Sonologic, http://www.sonologic.nl/
Networking, embedded systems, unix expertise, artificial intelligence.
Public PGP key: http://www.metro.cx/pubkey-gmc.asc
Wondering about the funny attachment your mail program
can't read? Visit http://www.openpgp.org/

                 reply	other threads:[~2004-12-27 15:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041227152054.GA14835@metro.cx \
    --to=kmartens@sonologic.nl \
    --cc=dwmw2@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=trivial@rustcorp.com.au \
    /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