public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Miquel Raynal <miquel.raynal@free-electrons.com>
Cc: Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: Fix mtd_check_oob_ops()
Date: Mon, 18 Dec 2017 09:14:13 +0100	[thread overview]
Message-ID: <20171218091413.2150cc0f@bbrezillon> (raw)
In-Reply-To: <20171218072628.17977-1-miquel.raynal@free-electrons.com>

Hi Miquel,

On Mon, 18 Dec 2017 08:26:28 +0100
Miquel Raynal <miquel.raynal@free-electrons.com> wrote:

> The mtd_check_oob_ops() helper verifies if the operation defined by the
> user is correct.
> 
> Fix the check that verifies if the entire requested area exists. This
> check is too restrictive and will fail anytime the last data byte of the
> very last page is included in an operation.
> 
> Fixes: 5cdd929da53d ("mtd: Add sanity checks in mtd_write/read_oob()")
> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

and thanks for fixing my mess.

Richard, feel free to queue it for the next -rc.

Boris

> ---
>  drivers/mtd/mtdcore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index f80e911b8843..73b605577447 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -1114,7 +1114,7 @@ static int mtd_check_oob_ops(struct mtd_info *mtd, loff_t offs,
>  	if (!ops->oobbuf)
>  		ops->ooblen = 0;
>  
> -	if (offs < 0 || offs + ops->len >= mtd->size)
> +	if (offs < 0 || offs + ops->len > mtd->size)
>  		return -EINVAL;
>  
>  	if (ops->ooblen) {

      parent reply	other threads:[~2017-12-18  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  7:26 [PATCH] mtd: Fix mtd_check_oob_ops() Miquel Raynal
2017-12-18  7:55 ` Richard Weinberger
2017-12-18  8:14 ` Boris Brezillon [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=20171218091413.2150cc0f@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@free-electrons.com \
    --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