From: Stefan Agner <stefan@agner.ch>
To: boris.brezillon@free-electrons.com
Cc: richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com,
linux-mtd@lists.infradead.org, Stefan Agner <stefan@agner.ch>
Subject: [PATCH] mtd: nand: warn if hamming layout is used with too large ECC
Date: Fri, 9 Feb 2018 00:33:05 +0100 [thread overview]
Message-ID: <20180208233305.20583-1-stefan@agner.ch> (raw)
Warn in case a driver uses too large ECC with hamming layout.
This is especially helpful since hamming layout is the default
layout when using hardware ECC and no specific OOB layout is
specified.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/mtd/nand/nand_base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 96c97588e1ba..2f3f43d0e288 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -197,6 +197,8 @@ static int nand_ooblayout_free_lp_hamming(struct mtd_info *mtd, int section,
return -EINVAL;
}
+ WARN_ON(mtd->oobsize - ecc_offset < ecc->total);
+
if (section == 0) {
oobregion->offset = 2;
oobregion->length = ecc_offset - 2;
--
2.16.1
next reply other threads:[~2018-02-08 23:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 23:33 Stefan Agner [this message]
2018-02-09 8:50 ` [PATCH] mtd: nand: warn if hamming layout is used with too large ECC Boris Brezillon
2018-02-09 9:20 ` Stefan Agner
2018-02-09 9:34 ` Boris Brezillon
2018-02-09 9:54 ` Boris Brezillon
2018-02-09 11:51 ` Stefan Agner
2018-02-09 9:58 ` Boris Brezillon
2018-02-09 11:55 ` Stefan Agner
2018-02-12 9:34 ` Boris Brezillon
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=20180208233305.20583-1-stefan@agner.ch \
--to=stefan@agner.ch \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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