aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-09 14:25:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-09 14:25:45 -0400
commit22b6dd78aec32abf38d9b187dea2e0a8b28aa186 (patch)
tree2298894b174ae00b86d7ab54e4c4bdec627ba163
parent63f4711aec01586e92c26da08a24bff0b8d16aa2 (diff)
parent6560ffd1ccd688152393dc7c35dbdcc33140633b (diff)
Merge tag 'regmap-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull last minute regman bug fix from Mark Brown: "This is a last minute bug fix that was only just noticed since the code path that's being exercised here is one that is fairly rarely used. The changelog for the change itself is extremely clear and the code itself is obvious to inspection so should be pretty safe." * tag 'regmap-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: fix possible memory corruption in regmap_bulk_read()
-rw-r--r--drivers/base/regmap/regmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 7a3f535e481c..bb80853ff27a 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -775,9 +775,11 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
775 map->format.parse_val(val + i); 775 map->format.parse_val(val + i);
776 } else { 776 } else {
777 for (i = 0; i < val_count; i++) { 777 for (i = 0; i < val_count; i++) {
778 ret = regmap_read(map, reg + i, val + (i * val_bytes)); 778 unsigned int ival;
779 ret = regmap_read(map, reg + i, &ival);
779 if (ret != 0) 780 if (ret != 0)
780 return ret; 781 return ret;
782 memcpy(val + (i * val_bytes), &ival, val_bytes);
781 } 783 }
782 } 784 }
783 785