Skip to content

Commit 86effbe

Browse files
Dan Carpenterbroonie
authored andcommitted
regmap-i2c: Off by one in regmap_i2c_smbus_i2c_read/write()
The commit message says that we are allowed to read and write up to 32 bytes but the code only allows us to write 31 bytes. In other words, the ">=" should be changed to ">". But this is already checked in regmap_raw_read()/write() so we can just remove the if statemetents. Fixes: 2933253 ("regmap-i2c: Add smbus i2c block support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a75de77 commit 86effbe

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

‎drivers/base/regmap/regmap-i2c.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ static int regmap_i2c_smbus_i2c_write(void *context, const void *data,
217217

218218
if (count < 1)
219219
return -EINVAL;
220-
if (count >= I2C_SMBUS_BLOCK_MAX)
221-
return -E2BIG;
222220

223221
--count;
224222
return i2c_smbus_write_i2c_block_data(i2c, ((u8 *)data)[0], count,
@@ -235,8 +233,6 @@ static int regmap_i2c_smbus_i2c_read(void *context, const void *reg,
235233

236234
if (reg_size != 1 || val_size < 1)
237235
return -EINVAL;
238-
if (val_size >= I2C_SMBUS_BLOCK_MAX)
239-
return -E2BIG;
240236

241237
ret = i2c_smbus_read_i2c_block_data(i2c, ((u8 *)reg)[0], val_size, val);
242238
if (ret == val_size)

0 commit comments

Comments
 (0)