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 2/3] mtd: move zero length verification to MTD API functions
Date: Wed, 08 Feb 2012 14:42:53 +0200 [thread overview]
Message-ID: <1328704973.22240.60.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <20120207143505.6fba6d5b@pixies.home.jungo.com>
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
On Tue, 2012-02-07 at 14:35 +0200, Shmulik Ladkani wrote:
> On Mon, 6 Feb 2012 14:03:08 +0200 Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > @@ -712,6 +717,8 @@ int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
> > return -EOPNOTSUPP;
> > if (from < 0 || from > mtd->size || len > mtd->size - from)
> > return -EINVAL;
> > + if (!len)
> > + return 0;
> > return mtd->_point(mtd, from, len, retlen, virt, phys);
> > }
>
> Previously, '_point' implementors usually assigned *virt (e.g. for NOR -
> to the relevant ioremapped address), regardless 'len' value.
> Meaning, *virt was set, even in the 'len == 0' case.
> New 'mtd_point()' does not set *virt in this case.
>
> (Luckily, seems there are no calls to 'mtd_point' with zero 'len'...)
>
> I guess it is safe to assume the *virt assignment in the '!len' case was
> wrong?
If length is zero then 'virt' is anyway useless. But we should set it to
NULL in 'mtd_point()' to make sure that if someone accesses it he gets
an oops. I'll amend the patch and update the commit message
correspondingly, thanks a lot for review.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2012-02-08 12:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 12:03 [PATCH 1/3] mtd: remove retlen zeroing duplication Artem Bityutskiy
2012-02-06 12:03 ` [PATCH 2/3] mtd: move zero length verification to MTD API functions Artem Bityutskiy
2012-02-07 12:35 ` Shmulik Ladkani
2012-02-08 12:42 ` Artem Bityutskiy [this message]
2012-02-08 13:26 ` Artem Bityutskiy
2012-02-08 14:54 ` Shmulik Ladkani
2012-02-08 16:06 ` Artem Bityutskiy
2012-02-06 12:03 ` [PATCH 3/3] mtd: remove junk pmc551.h Artem Bityutskiy
2012-02-07 7:47 ` [PATCH 1/3] mtd: remove retlen zeroing duplication Shmulik Ladkani
2012-02-07 8:02 ` Artem Bityutskiy
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=1328704973.22240.60.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