From 267c85860308d36bc163c5573308cd024f659d7c Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Wed, 23 Mar 2016 09:26:33 -0500 Subject: [PATCH 1/2] regmap: cache: Fix typo in cache_bypass parameter description Setting the flag 'cache_bypass' will bypass the cache not the hardware. Fix this comment here. Fixes: 0eef6b0415f5 ("regmap: Fix doc comment") Signed-off-by: Andrew F. Davis Signed-off-by: Mark Brown --- drivers/base/regmap/regcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 4170b7d95276..df7ff7290821 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -529,7 +529,7 @@ EXPORT_SYMBOL_GPL(regcache_mark_dirty); * regcache_cache_bypass: Put a register map into cache bypass mode * * @map: map to configure - * @cache_bypass: flag if changes should not be written to the hardware + * @cache_bypass: flag if changes should not be written to the cache * * When a register map is marked with the cache bypass option, writes * to the register map API will only update the hardware and not the From 6e4f28780f38e27cb7ca0edeb1d7ebb4edfd1fc5 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Tue, 29 Mar 2016 08:53:32 +0200 Subject: [PATCH 2/2] regcache: flat: Require max_registers to be set If max_register is unset, regcache_flat_get_index will return 0 and only memory for 1 unsigned int will be allocated, resulting in writing out of bounds. Signed-off-by: Alexander Stein Signed-off-by: Mark Brown --- drivers/base/regmap/regcache-flat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/regmap/regcache-flat.c b/drivers/base/regmap/regcache-flat.c index 3ee72550b1e3..4d2e50bfc726 100644 --- a/drivers/base/regmap/regcache-flat.c +++ b/drivers/base/regmap/regcache-flat.c @@ -27,7 +27,7 @@ static int regcache_flat_init(struct regmap *map) int i; unsigned int *cache; - if (!map || map->reg_stride_order < 0) + if (!map || map->reg_stride_order < 0 || !map->max_register) return -EINVAL; map->cache = kcalloc(regcache_flat_get_index(map, map->max_register)