mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 2/2] environment: Do not use environment when overlapping with other partitions
Date: Wed, 26 Sep 2018 08:55:20 +0200	[thread overview]
Message-ID: <20180926065520.GO4097@pengutronix.de> (raw)
In-Reply-To: <CAHQ1cqG6fuum4RKKXhLKZu+1CWMVTaU7cU9xyjSwLAO_eaKBGw@mail.gmail.com>

On Mon, Sep 24, 2018 at 06:23:02AM -0700, Andrey Smirnov wrote:
> On Fri, Sep 21, 2018 at 5:44 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > Environment partitions are usually specified with their hardcoded offset
> > and size, either in the device tree or the board file. These partitions
> > potentially overlap with other partitions read from the partition table.
> > Overlapping partitions for sure have bad effects. Be more friendly to our
> > users and warn them when such a situation occurs and stop using that
> > partition for storing the environment.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  common/startup.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
> >  include/common.h | 10 ++++++++++
> >  2 files changed, 57 insertions(+), 1 deletion(-)
> >
> > diff --git a/common/startup.c b/common/startup.c
> > index 8553849cb3..f6bb1f1947 100644
> > --- a/common/startup.c
> > +++ b/common/startup.c
> > @@ -73,16 +73,62 @@ fs_initcall(mount_root);
> >  #endif
> >
> >  #ifdef CONFIG_ENV_HANDLING
> > +static int check_overlap(const char *path)
> > +{
> > +       struct cdev *cenv, *cdisk, *cpart;
> > +
> > +       if (strncmp(path, "/dev/", 5))
> > +               return 0;
> > +
> > +       path = devpath_to_name(path);
> 
> Minor suggestions: you can drop the strcmp above by relying on the
> fact that, if argument given to devpath_to_name() does not have
> "/dev/" in front of it, the return value would be that same as the
> argument. IOW, replace the above with:
> 
> name = devpath_to_name(path);
> 
> if (name == path) /* No "/dev" in front */
>     return 0;

Did that, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

      reply	other threads:[~2018-09-26  6:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 12:29 [PATCH 1/2] environment: Allow default env path to be NULL Sascha Hauer
2018-09-21 12:29 ` [PATCH 2/2] environment: Do not use environment when overlapping with other partitions Sascha Hauer
2018-09-24 13:23   ` Andrey Smirnov
2018-09-26  6:55     ` Sascha Hauer [this message]

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=20180926065520.GO4097@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.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