From: Artem Bityutskiy <dedekind1@gmail.com>
To: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Cc: MTD Maling List <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH 4/4] mtd: remove R/O checking duplication
Date: Mon, 06 Feb 2012 11:12:20 +0200 [thread overview]
Message-ID: <1328519540.22240.29.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <20120205103321.0a7e2e1c@pixies.home.jungo.com>
[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]
On Sun, 2012-02-05 at 10:33 +0200, Shmulik Ladkani wrote:
> On Fri, 3 Feb 2012 19:01:31 +0200 Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> > index 13bd4fa..78e1df6 100644
> > --- a/drivers/mtd/mtdcore.c
> > +++ b/drivers/mtd/mtdcore.c
> > @@ -754,7 +756,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
> > const u_char *buf)
> > {
> > *retlen = 0;
> > - if (!mtd->_write)
> > + if (!mtd->_write || !(mtd->flags & MTD_WRITEABLE))
> > return -EROFS;
> > if (to < 0 || to > mtd->size || len > mtd->size - to)
> > return -EINVAL;
>
> (sorry for nit-picking)
No need to sorry, you are very welcome - I am happy when people spot
issues before patches get merged.
> Here you perform "writable" (EROFS) validation prior offset/length
> validation (EINVAL) - however in other API funtions you had it
> vice-versa.
> Really not that important, but better if handling is consistent.
I think this is rather important to first validate the input parameters
and then check for R/O. I've done this in other functions, but failed to
do in 'mtd_write()'. Fixed in l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2012-02-06 9:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-03 17:01 [PATCH 1/4] mtd: return error code from mtd_unpoint Artem Bityutskiy
2012-02-03 17:01 ` [PATCH 2/4] mtd: add offset and length checks to the API function Artem Bityutskiy
2012-02-03 17:01 ` [PATCH 3/4] mtd: do not duplicate length and offset checks in drivers Artem Bityutskiy
2012-02-03 17:01 ` [PATCH 4/4] mtd: remove R/O checking duplication Artem Bityutskiy
2012-02-05 8:33 ` Shmulik Ladkani
2012-02-06 9:12 ` Artem Bityutskiy [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=1328519540.22240.29.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=shmulik.ladkani@gmail.com \
/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