diff options
author | Fan Du <fan.du@intel.com> | 2014-09-16 17:21:04 +0800 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-10-13 14:25:31 +0200 |
commit | 19c365577e5de2b3f671ad2efbe7556e1f5dcc38 (patch) | |
tree | 2107c8f00b1bf713727f4c7035ce2c84b907f0d5 /drivers/i2c/busses | |
parent | af8d4c48a1e245b8110e329a4cbd14280aa5bc30 (diff) | |
download | lwn-19c365577e5de2b3f671ad2efbe7556e1f5dcc38.tar.gz lwn-19c365577e5de2b3f671ad2efbe7556e1f5dcc38.zip |
i2c: ismt: use correct length when copy buffer
commit 979bbf7b7ae75cfc06e09d09eda38009a3bdc4a4 upstream.
In block write mode, when encapsulating dma_buffer, first element is
'command', the rest is data buffer, so only copy actual data buffer
starting from block[1] with the size indicating by block[0].
Signed-off-by: Fan Du <fan.du@intel.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-ismt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 1672effbcebb..303972ddd7d6 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c @@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, desc->wr_len_cmd = dma_size; desc->control |= ISMT_DESC_BLK; priv->dma_buffer[0] = command; - memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); + memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); } else { /* Block Read */ dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); |