summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-02-08 10:23:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-24 10:34:10 +0300
commitcddf0e1ce6c7d68e2f6e004079396a238de5f86a (patch)
tree62a7eceb347087d1cad20eb35bdd2f2eebf2e961 /drivers/base
parent9c78aeef4272a6ded4bbf500ae611050904daaa9 (diff)
downloadlinux-cddf0e1ce6c7d68e2f6e004079396a238de5f86a.tar.xz
regmap: Fix reversed bounds check in regmap_raw_write()
commit f00e71091ab92eba52122332586c6ecaa9cd1a56 upstream. 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: c335931ed9d2 ("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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index ae63bb0875ea..a7b0fc7cb468 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1736,7 +1736,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
return -EINVAL;
if (val_len % map->format.val_bytes)
return -EINVAL;
- if (map->max_raw_write && map->max_raw_write > val_len)
+ if (map->max_raw_write && map->max_raw_write < val_len)
return -E2BIG;
map->lock(map->lock_arg);