]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: rawnand: tegra: check bounds of die_nr properly
authorStefan Agner <stefan@agner.ch>
Tue, 17 Jul 2018 08:46:18 +0000 (10:46 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 19 Jul 2018 21:14:13 +0000 (23:14 +0200)
commit5764a8f74f25b7eee1b4adfe863e9de48be7c5f6
treee1e655a818b78cce1707169d16fb8ceb7d5d0536
parent485270697c815a40552b06f2a1124bb95fe7c480
mtd: rawnand: tegra: check bounds of die_nr properly

The Tegra driver currently only support a single chip select, hence
check boundaries accordingly. This fixes a off by one issue catched
with Smatch:
    drivers/mtd/nand/raw/tegra_nand.c:476 tegra_nand_select_chip()
    warn: array off by one? 'nand->cs[die_nr]'

Also warn in case the stack asks for a chip select we currently do
not support.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/tegra_nand.c