diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-04-06 23:16:03 +0200 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-13 12:29:19 +0200 |
commit | 2690dfdb05abf3a8e11ff21ec12dbbe620a026fb (patch) | |
tree | a4d59b2839ca8af08843abdba514ae37cf726ac9 /drivers/base/regmap/regmap.c | |
parent | regmap: mmio: remove some error checks now in the core (diff) | |
download | linux-2690dfdb05abf3a8e11ff21ec12dbbe620a026fb.tar.xz linux-2690dfdb05abf3a8e11ff21ec12dbbe620a026fb.zip |
regmap: validate regmap_raw_read/write val_len
val_len should be a multiple of val_bytes. If it's not, error out early.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/base/regmap/regmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 004a08d54f07..e6038bc54210 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -621,6 +621,9 @@ int regmap_raw_write(struct regmap *map, unsigned int reg, { int ret; + if (val_len % map->format.val_bytes) + return -EINVAL; + map->lock(map); ret = _regmap_raw_write(map, reg, val, val_len); @@ -779,6 +782,9 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val, unsigned int v; int ret, i; + if (val_len % map->format.val_bytes) + return -EINVAL; + map->lock(map); if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass || |