From: Hoan Tran Date: Mon, 10 Oct 2016 17:13:10 +0000 (-0700) Subject: i2c: xgene: Avoid dma_buffer overrun X-Git-Tag: MMI-PSA29.97-13-9~6876^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=603616017c35f4d0fbdbcace72adf9bf949c4a65;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git i2c: xgene: Avoid dma_buffer overrun SMBus block command uses the first byte of buffer for the data length. The dma_buffer should be increased by 1 to avoid the overrun issue. Reported-by: Phil Endecott Signed-off-by: Hoan Tran Signed-off-by: Wolfram Sang Cc: stable@kernel.org --- diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c index 263685c7a512..05cf192ef1ac 100644 --- a/drivers/i2c/busses/i2c-xgene-slimpro.c +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c @@ -105,7 +105,7 @@ struct slimpro_i2c_dev { struct mbox_chan *mbox_chan; struct mbox_client mbox_client; struct completion rd_complete; - u8 dma_buffer[I2C_SMBUS_BLOCK_MAX]; + u8 dma_buffer[I2C_SMBUS_BLOCK_MAX + 1]; /* dma_buffer[0] is used for length */ u32 *resp_msg; };