public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd/onenand.c: block align warning
Date: Tue, 13 Sep 2016 07:40:00 +0200	[thread overview]
Message-ID: <20160913054000.GA1917@localhost.localdomain> (raw)

An attempt to write non block aligned data fails silently, add warning and
set result.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 cmd/onenand.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmd/onenand.c b/cmd/onenand.c
index feab01a..090f835 100644
--- a/cmd/onenand.c
+++ b/cmd/onenand.c
@@ -139,6 +139,12 @@ static int onenand_block_write(loff_t to, size_t len,
 	size_t _retlen = 0;
 	int ret;
 
+	if ((to & (mtd->writesize - 1)) != 0) {
+		printf("Attempt to write non block-aligned data\n");
+		*retlen = 0;
+		return 1;
+	}
+
 	if (to == next_ofs) {
 		next_ofs = to + len;
 		to += skip_ofs;
-- 
2.1.4

             reply	other threads:[~2016-09-13  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13  5:40 Ladislav Michl [this message]
2016-10-08 17:05 ` [U-Boot] cmd/onenand.c: block align warning Tom Rini

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=20160913054000.GA1917@localhost.localdomain \
    --to=ladis@linux-mips.org \
    --cc=u-boot@lists.denx.de \
    /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