qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 3/6] nand: fix flash erase when oob is in memory
Date: Wed, 25 Nov 2015 15:10:21 +0100	[thread overview]
Message-ID: <1448460624-16664-4-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1448460624-16664-1-git-send-email-kwolf@redhat.com>

From: Ricard Wanderlof <ricard.wanderlof@axis.com>

For the "main area on file, oob in memory" case, fix the shifts so that
we erase the correct number of pages.

Signed-off-by: Ricard Wanderlöf <ricardw@axis.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/block/nand.c b/hw/block/nand.c
index a68266f..f0e3413 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -712,7 +712,7 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s)
         memset(s->storage + (PAGE(addr) << OOB_SHIFT),
                         0xff, OOB_SIZE << s->erase_shift);
         i = SECTOR(addr);
-        page = SECTOR(addr + (ADDR_SHIFT + s->erase_shift));
+        page = SECTOR(addr + (1 << (ADDR_SHIFT + s->erase_shift)));
         for (; i < page; i ++)
             if (blk_write(s->blk, i, iobuf, 1) < 0) {
                 printf("%s: write error in sector %" PRIu64 "\n", __func__, i);
-- 
1.8.3.1

  parent reply	other threads:[~2015-11-25 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 14:10 [Qemu-devel] [PULL 0/6] Block patches for 2.5.0-rc2 Kevin Wolf
2015-11-25 14:10 ` [Qemu-devel] [PULL 1/6] tests/Makefile: Add more dependencies for test-timed-average Kevin Wolf
2015-11-25 14:10 ` [Qemu-devel] [PULL 2/6] test-aio: Fix event notifier cleanup Kevin Wolf
2015-11-25 14:10 ` Kevin Wolf [this message]
2015-11-25 14:10 ` [Qemu-devel] [PULL 4/6] raw-posix.c: Make GetBSDPath() handle caching options Kevin Wolf
2015-11-25 14:10 ` [Qemu-devel] [PULL 5/6] block/qapi: Plug memory leak on query-block error path Kevin Wolf
2015-11-25 14:10 ` [Qemu-devel] [PULL 6/6] qemu-iotests: Add -nographic when starting QEMU in 119 and 120 Kevin Wolf
2015-11-25 16:20 ` [Qemu-devel] [PULL 0/6] Block patches for 2.5.0-rc2 Peter Maydell

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=1448460624-16664-4-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).