]> git.baikalelectronics.ru Git - kernel.git/commit
spi: Prevent unexpected SPI time out due to arithmetic overflow
authorSien Wu <sien.wu@ni.com>
Thu, 1 Sep 2016 23:24:29 +0000 (18:24 -0500)
committerMark Brown <broonie@kernel.org>
Sat, 3 Sep 2016 10:58:13 +0000 (11:58 +0100)
commit1789a21b59f6ecaa75248cb2b61bf7fca6445290
tree810fecfc8a20b65e031b5586c34ce7a64932025f
parentb482605f7939bd4035b2d11a7952dc3da5821c6d
spi: Prevent unexpected SPI time out due to arithmetic overflow

When reading SPI flash as MTD device, the transfer length is
directly passed to the spi driver. If the requested data size
exceeds 512KB, it will cause the time out calculation to
overflow since transfer length is 32-bit unsigned integer.
This issue is resolved by using 64-bit unsigned integer
to perform the arithmetic.

Signed-off-by: Sien Wu <sien.wu@ni.com>
Acked-by: Brad Keryan <brad.keryan@ni.com>
Acked-by: Gratian Crisan <gratian.crisan@ni.com>
Acked-by: Brad Mouring <brad.mouring@ni.com>
Natinst-ReviewBoard-ID 150232
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c