提交 2690dfdb 编写于 作者: S Stephen Warren 提交者: Mark Brown

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: NStephen Warren <swarren@nvidia.com>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 8664d490
......@@ -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 ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册