From: Wolfram Sang Date: Sat, 9 Jan 2021 12:43:08 +0000 (+0100) Subject: i2c: octeon: check correct size of maximum RECV_LEN packet X-Git-Tag: accepted/tizen/unified/20230118.172025~8033^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b2cfa2d1dbdcc3b6dba1ecb7026a537a1d7277f;p=platform%2Fkernel%2Flinux-rpi.git i2c: octeon: check correct size of maximum RECV_LEN packet I2C_SMBUS_BLOCK_MAX defines already the maximum number as defined in the SMBus 2.0 specs. No reason to add one to it. Fixes: 886f6f8337dd ("i2c: octeon: Support I2C_M_RECV_LEN") Signed-off-by: Wolfram Sang Reviewed-by: Robert Richter Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c index d960790..845eda7 100644 --- a/drivers/i2c/busses/i2c-octeon-core.c +++ b/drivers/i2c/busses/i2c-octeon-core.c @@ -347,7 +347,7 @@ static int octeon_i2c_read(struct octeon_i2c *i2c, int target, if (result) return result; if (recv_len && i == 0) { - if (data[i] > I2C_SMBUS_BLOCK_MAX + 1) + if (data[i] > I2C_SMBUS_BLOCK_MAX) return -EPROTO; length += data[i]; }