i2c: stub: Avoid an array overrun on I2C block transfers
authorJean Delvare <jdelvare@suse.de>
Sun, 13 Jul 2014 15:17:17 +0000 (17:17 +0200)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 20 Jul 2014 11:25:29 +0000 (13:25 +0200)
commit0f6ba0d15f43e2be8cae9e3906aa03fcfe231e5b
treedd634397d359a03d834c35d4715818e89d80f5a0
parentb299de839157852c563b9f133c8b7e630545a9c3
i2c: stub: Avoid an array overrun on I2C block transfers

I2C block transfers can have a size up to 32 bytes. If starting close
to the end of the address space, there may not be enough room to write
that many bytes (on I2C block writes) or not enough bytes to be read
(on I2C block reads.) In that case, we must shorten the transfer so
that it does not exceed the address space.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-stub.c