Skip to content
Permalink
Browse files Browse the repository at this point in the history
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: 1406234 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
  • Loading branch information
Dan Carpenter authored and Cyrille Pitchen committed Nov 26, 2016
1 parent 022a400 commit 193e871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/spi-nor/cadence-quadspi.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 193e871

Please sign in to comment.