diff options
author | Arnd Bergmann <arnd@arndb.de> | 2016-11-08 14:46:12 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-11-09 13:05:19 +0000 |
commit | db30083813b559e98e10ae26bd09d3dc69be7fb7 (patch) | |
tree | beaa5957b74b8fd9ae82a4afe74dc9414c919394 /drivers/spi/spi-cavium.c | |
parent | 3be09bec42a800d4f8ead8119c462f3eb4fad435 (diff) |
spi: rspi: avoid uninitialized variable access
The newly introduced rspi_pio_transfer_in_or_our() function must
take either a valid 'rx' or 'tx' pointer, and has undefined behavior
if both are NULL, as found by 'gcc -Wmaybe-unintialized':
drivers/spi/spi-rspi.c: In function 'rspi_pio_transfer_in_or_our':
drivers/spi/spi-rspi.c:558:5: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
The analysis of the function is correct in principle, but the code
is currently safe because both callers always pass exactly one
of the two pointers.
Looking closer at this function shows that having a combined
method for rx and tx here actually increases the complexity
and the size of the file. This simplifies it again by keeping
the two separate, which then ends up avoiding that warning.
Fixes: 3be09bec42a8 ("spi: rspi: supports 32bytes buffer for DUAL and QUAD")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-cavium.c')
0 files changed, 0 insertions, 0 deletions