lkml.org 
[lkml]   [2017]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mtd: spi-nor: Kill check with no effect
From
Date
Le 17/09/2017 à 16:13, Richard Weinberger a écrit :
> header.major is of type u8 and cannot be negative.
>
> 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>

Applied to the spi-nor/next branch of l2-mtd

I've replaced header.major by header.minor in the commit message as
reported by Boris.

Thanks!

> ---
> 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;
>
> /*
>

\
 
 \ /
  Last update: 2017-10-10 17:05    [W:0.250 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site