i2c: xlp9xx: Make sure the transfer size is not more than I2C_SMBUS_BLOCK_SIZE
authorGeorge Cherian <george.cherian@cavium.com>
Wed, 16 May 2018 07:00:18 +0000 (00:00 -0700)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 22 May 2018 12:06:34 +0000 (14:06 +0200)
commit88b4116e7e98454c2131094336e4f8861eebbd85
tree639eed4ee889c536ec063ae06bc76ca78948d6f9
parent8d504d804ab657779254bdd37079d2442d75cbe8
i2c: xlp9xx: Make sure the transfer size is not more than I2C_SMBUS_BLOCK_SIZE

For SMBus transactions the max permissible transfer size is
I2C_SMBUS_BLOCK_SIZE. It is possible that some clients might
not follow it strictly occasionally.
This would lead to stack corruption if the driver copies more than
I2C_SMBUS_BLOCK_SIZE bytes. Add a check to avoid such conditions.

Signed-off-by: Jayachandran C <jnair@caviumnetworks.com>
Signed-off-by: George Cherian <george.cherian@cavium.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/i2c-xlp9xx.c