public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Kill check with no effect
@ 2017-09-17 14:13 Richard Weinberger
  2017-09-18  9:44 ` Boris Brezillon
  2017-10-10 15:04 ` Cyrille Pitchen
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Weinberger @ 2017-09-17 14:13 UTC (permalink / raw)
  To: linux-mtd
  Cc: linux-kernel, boris.brezillon, computersforpeace, dwmw2,
	marek.vasut, cyrille.pitchen, Richard Weinberger

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-10 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-17 14:13 [PATCH] mtd: spi-nor: Kill check with no effect Richard Weinberger
2017-09-18  9:44 ` Boris Brezillon
2017-09-18 13:35   ` Richard Weinberger
2017-09-19 17:10   ` Cyrille Pitchen
2017-10-10 15:04 ` Cyrille Pitchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox