public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Linux mtd <linux-mtd@lists.infradead.org>
Subject: Fix docg3 read align bug
Date: Sun, 25 Mar 2012 23:47:29 +0200	[thread overview]
Message-ID: <87haxcs68e.fsf@free.fr> (raw)

Hi Artem,

I sent not long ago a patch for unaligned reads. And ... I made an error. I have
a patch to patch my previous submission. I wonder if this can be squashed in, or
requires an incremental commit. Tell me what you want to do, the patch is at the
end of the mail.

I hope I have not overseen another corner case, I'll recheck tomorrow evening
(GMT+1).

Cheers.

-- 
Robert

---8>---
>From c013bc50a456c3c127eae3f1751369dec1e32221 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Sun, 25 Mar 2012 23:26:05 +0200
Subject: [PATCH] mtd: docg3 refix docg3 lessen read alignement burden

After the fix "mtd: docg3 less read alignement burden", a corner case
where read is unaligned an length read is small was left. As a full
page must be read, the remaining data bytes to read number was
miscalculated, leading to unreadable LEBs by UBIFS.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mtd/devices/docg3.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 7ced089..8272c02 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -893,7 +893,8 @@ static int doc_read_oob(struct mtd_info *mtd, loff_t from,
 		ret = doc_read_page_getbytes(docg3, nbdata, buf, 0);
 		if (ret < nbdata)
 			goto err_in_read;
-		doc_read_page_getbytes(docg3, DOC_LAYOUT_PAGE_SIZE - nbdata,
+		doc_read_page_getbytes(docg3,
+				       DOC_LAYOUT_PAGE_SIZE - nbdata - skip,
 				       NULL, 0);
 		ret = doc_read_page_getbytes(docg3, nboob, oobbuf, 0);
 		if (ret < nboob)
-- 
1.7.5.4

             reply	other threads:[~2012-03-25 21:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 21:47 Robert Jarzmik [this message]
2012-03-26  9:51 ` Fix docg3 read align bug Artem Bityutskiy

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=87haxcs68e.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=dedekind1@gmail.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