All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	cyrille.pitchen@wedev4u.fr, computersforpeace@gmail.com,
	dwmw2@infradead.org
Subject: Re: [PATCH] mtd: spi-nor: Kill check with no effect
Date: Mon, 18 Sep 2017 11:44:51 +0200	[thread overview]
Message-ID: <20170918114451.74e6fe68@bbrezillon> (raw)
In-Reply-To: <20170917141352.23691-1-richard@nod.at>

On Sun, 17 Sep 2017 16:13:52 +0200
Richard Weinberger <richard@nod.at> wrote:

> header.major is of type u8 and cannot be negative.

I guess you meant header.minor here.

> 
> Detected by CoverityScan CID#1417858 ("Integer handling issues")
> 
> Fixes: f384b352cbf0 ("mtd: spi-nor: parse Serial Flash Discoverable
> Parameters (SFDP) tables")
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> Cyrille,
> 
> I'm not sure what exactly you wanted to test.
> Maybe it makes sense casting header.major to s8 before checking against < 0?
> 
> Thanks,
> //richard
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index d71765739a93..4b86decdf13e 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -2252,8 +2252,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
>  
>  	/* Check the SFDP header version. */
>  	if (le32_to_cpu(header.signature) != SFDP_SIGNATURE ||
> -	    header.major != SFDP_JESD216_MAJOR ||
> -	    header.minor < SFDP_JESD216_MINOR)
> +	    header.major != SFDP_JESD216_MAJOR)
>  		return -EINVAL;
>  
>  	/*

  reply	other threads:[~2017-09-18  9:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17 14:13 [PATCH] mtd: spi-nor: Kill check with no effect Richard Weinberger
2017-09-18  9:44 ` Boris Brezillon [this message]
2017-09-18 13:35   ` Richard Weinberger
2017-09-19 17:10   ` Cyrille Pitchen
2017-10-10 15:04 ` Cyrille Pitchen

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=20170918114451.74e6fe68@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.