[U-Boot] [PATCH v1 1/5] regmap: Fix potential overflow in regmap_update_bits()
Jean-Jacques Hiblot
jjhiblot at ti.com
Fri Sep 27 13:22:17 UTC 2019
Mask the value to write so that it cannot affect the bits outside of the
mask
Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
---
drivers/core/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index d1d12eef38..e9e55c9d16 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -462,5 +462,5 @@ int regmap_update_bits(struct regmap *map, uint offset, uint mask, uint val)
reg &= ~mask;
- return regmap_write(map, offset, reg | val);
+ return regmap_write(map, offset, reg | (val & mask));
}
--
2.17.1
More information about the U-Boot
mailing list