Skip to content

Commit f00e710

Browse files
Dan Carpenterbroonie
authored andcommitted
regmap: Fix reversed bounds check in regmap_raw_write()
We're supposed to be checking that "val_len" is not too large but instead we check if it is smaller than the max. The only function affected would be regmap_i2c_smbus_i2c_write() in drivers/base/regmap/regmap-i2c.c. Strangely that function has its own limit check which returns an error if (count >= I2C_SMBUS_BLOCK_MAX) so it doesn't look like it has ever been able to do anything except return an error. Fixes: c335931 ("regmap: Add raw_write/read checks for max_raw_write/read sizes") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
1 parent a75de77 commit f00e710

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/base/regmap/regmap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1831,7 +1831,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
18311831
return -EINVAL;
18321832
if (val_len % map->format.val_bytes)
18331833
return -EINVAL;
1834-
if (map->max_raw_write && map->max_raw_write > val_len)
1834+
if (map->max_raw_write && map->max_raw_write < val_len)
18351835
return -E2BIG;
18361836

18371837
map->lock(map->lock_arg);

0 commit comments

Comments
 (0)