mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Ladislav Michl <ladis@linux-mips.org>
Subject: [PATCH] environment: bypass overlap check for mtd devices
Date: Fri, 12 Oct 2018 09:03:27 +0200	[thread overview]
Message-ID: <20181012070327.12143-1-s.hauer@pengutronix.de> (raw)

For mtd devices the overlap check does not work as expected for two
reasons. First is that cdev->offset is 0 for mtd partitions, instead
cdev->mtd->master_offset has to be used. That could be fixed easily.
Second on NAND devices the environment is on the bb devices and not
on the raw nand devices which means we would need something to get
the mtd device from the bb device before doing the check.

Both issues are fixable, but the check was mainly done to catch cases
when an environment partition is created in the free space before the
first MBR/GPT partition on SD/MMC devices, so leave out the mtd case
for now.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/startup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/startup.c b/common/startup.c
index 5793ea28ac..28edee4fce 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -91,6 +91,9 @@ static int check_overlap(const char *path)
 	if (!cenv)
 		return -EINVAL;
 
+	if (cenv->mtd)
+		return 0;
+
 	cdisk = cenv->master;
 
 	if (!cdisk)
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-10-12  7:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20181012070327.12143-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ladis@linux-mips.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