mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
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>
This commit is contained in:
parent
8664d4901f
commit
2690dfdb05
|
|
@ -621,6 +621,9 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (val_len % map->format.val_bytes)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
map->lock(map);
|
map->lock(map);
|
||||||
|
|
||||||
ret = _regmap_raw_write(map, reg, val, val_len);
|
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;
|
unsigned int v;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
|
if (val_len % map->format.val_bytes)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
map->lock(map);
|
map->lock(map);
|
||||||
|
|
||||||
if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
|
if (regmap_volatile_range(map, reg, val_count) || map->cache_bypass ||
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user