mtd: spi-nor: Off by one in cqspi_setup_flash()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Dec 16 11:59:14 PST 2016
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=193e87143c290ec16838f5368adc0e0bc94eb931
Commit: 193e87143c290ec16838f5368adc0e0bc94eb931
Parent: 022a400f90ceeb26405edd5e077d56e2f38c8123
Author: Dan Carpenter <dan.carpenter at oracle.com>
AuthorDate: Thu Oct 13 11:06:47 2016 +0300
Committer: Cyrille Pitchen <cyrille.pitchen at atmel.com>
CommitDate: Sat Nov 26 16:50:03 2016 +0100
mtd: spi-nor: Off by one in cqspi_setup_flash()
There are CQSPI_MAX_CHIPSELECT elements in the ->f_pdata array so the >
should be >=.
Fixes: 140623410536 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller')
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Reviewed-by: Marek Vasut <marex at denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen at atmel.com>
---
drivers/mtd/spi-nor/cadence-quadspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index d403ba7..944863b 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -1082,7 +1082,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi, struct device_node *np)
goto err;
}
- if (cs > CQSPI_MAX_CHIPSELECT) {
+ if (cs >= CQSPI_MAX_CHIPSELECT) {
dev_err(dev, "Chip select %d out of range.\n", cs);
goto err;
}
More information about the linux-mtd-cvs
mailing list