summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2016-09-13 07:40:00 +0200
committerTom Rini <trini@konsulko.com>2016-10-06 20:57:42 -0400
commit9c00d982f1d18fd1e8ed586dc1c041988aba4567 (patch)
treeb594e0121a9c3e42e2e7682e1cbb99d7b59c599c /cmd
parent362664356bc65219dbfc107e8ac7d0715016c409 (diff)
downloadu-boot-9c00d982f1d18fd1e8ed586dc1c041988aba4567.tar.gz
cmd/onenand.c: block align warning
An attempt to write non block aligned data fails silently, add warning and set result. Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/onenand.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/onenand.c b/cmd/onenand.c
index feab01a71e..d97844fa7a 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;