public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: "Stanley.Miao" <stanley.miao@windriver.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/1] mtd: nand: move the checking the validity of oob into nand_write_oob
Date: Mon, 15 Feb 2010 16:07:02 +0200	[thread overview]
Message-ID: <1266242822.11659.96.camel@localhost> (raw)
In-Reply-To: <1265267917-2487-2-git-send-email-stanley.miao@windriver.com>

On Thu, 2010-02-04 at 15:18 +0800, Stanley.Miao wrote:
> nand_write_oob will invoke nand_do_write_oob or nand_do_write_ops depending
> on if ops->datbuf is NULL. nand_do_write_oob checked the validity of oob
> but nand_do_write_ops didn't. Now move the check into nand_write_oob to
> ensure the validity of oobbuf.
> 
> Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
> ---
>  drivers/mtd/nand/nand_base.c |   69 ++++++++++++++++++++++-------------------
>  1 files changed, 37 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 8f2958f..29e2a06 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -2113,40 +2113,9 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len,
>  static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
>  			     struct mtd_oob_ops *ops)
>  {

...

> @@ -2203,6 +2172,42 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
>  		return -EINVAL;
>  	}
>  
> +	if (ops->oobbuf) {
> +		int len;
> +		DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, ooblen = %i\n",
> +				__func__, (unsigned int)to, (int)ops->ooblen);

Why this check is not done for !obs->oobbuf cas as well?


-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2010-02-15 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04  7:18 [PATCH 0/1] Fix OOB checking problem in nand_base.c Stanley.Miao
2010-02-04  7:18 ` [PATCH 1/1] mtd: nand: move the checking the validity of oob into nand_write_oob Stanley.Miao
2010-02-15 14:07   ` Artem Bityutskiy [this message]
2010-02-15 14:21     ` Maxim Levitsky

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=1266242822.11659.96.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=stanley.miao@windriver.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