From: David Updegraff <dave@cray.com>
To: linux-mtd@lists.infradead.org
Subject: Re: nand oob corruption recovery
Date: Thu, 01 Jul 2004 17:45:47 -0500 [thread overview]
Message-ID: <40E4941B.7070103@cray.com> (raw)
In-Reply-To: <200407012100.28033.tglx@linutronix.de>
[-- Attachment #1: Type: text/plain, Size: 158 bytes --]
Relevant to this; enclosed is small nandwrite.c patch that fixes
segfault and at least warns about upcomming OOB destruction in
large-block devices.
-dbu.
[-- Attachment #2: nandwrite.patch --]
[-- Type: text/x-patch, Size: 974 bytes --]
--- mtd/util/nandwrite.c.orig 2004-07-01 17:09:12.124117544 -0500
+++ mtd/util/nandwrite.c 2004-07-01 17:16:44.497346360 -0500
@@ -42,8 +42,8 @@
/*
* Buffer array used for writing data
*/
-unsigned char writebuf[512];
-unsigned char oobbuf[16];
+unsigned char *writebuf;
+unsigned char *oobbuf;
// oob layouts to pass into the kernel as default
struct nand_oobinfo none_oobinfo = {
@@ -223,6 +223,19 @@
close(fd);
exit(1);
}
+
+ /* NOW! allocate writebuf and oobbuf.. */
+ writebuf = malloc (meminfo.oobblock);
+ oobbuf = malloc (meminfo.oobsize);
+ if (!writebuf || !oobbuf)
+ perror ("cannot allocate buffers\n");
+ if ((forcejffs2 || forceyaffs || autoplace) && (meminfo.oobsize > 16))
+ {
+ fprintf (stderr, "\nDanger!Danger! Will Robinson, Overriding driver's AUTO_ECC layout for \nlarge-block chips will almost certainly trash OOB!\n Continue? (y/N)\n");
+ if (getchar () != 'y') {
+ exit(1);
+ }
+ }
// write without ecc ?
if (noecc) {
prev parent reply other threads:[~2004-07-01 22:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-01 17:24 nand oob corruption recovery David Updegraff
2004-07-01 19:00 ` Thomas Gleixner
2004-07-01 22:45 ` David Updegraff [this message]
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=40E4941B.7070103@cray.com \
--to=dave@cray.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