Skip to contentSkip to conversation

regmap: regcache-rbtree: Fix present bitmap resize

PATCH Applied Lars-Peter Clausen 3 participants 3 messages Mar 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regmap: regcache-rbtree: Fix present bitmap resize

When inserting a new register into a block at the lower end the present bitmap is currently shifted into the wrong direction. The effect of this is that the bitmap becomes corrupted and registers which are present might be reported as not present and vice versa.

Fix this by shifting left rather than right.

Fixes 472fdec7380c("regmap: rbtree: Reduce number of nodes, take 2")
---
 drivers/base/regmap/regcache-rbtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regcache-rbtree.c +1 -1
index d453a2c..81751a4 100644
@@ -307,7 +307,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
 	if (pos == 0) {
 		memmove(blk + offset * map->cache_word_size,
 			blk, rbnode->blklen * map->cache_word_size);
-		bitmap_shift_right(present, present, offset, blklen);
+		bitmap_shift_left(present, present, offset, blklen);
 	}
 
 	/* update the rbnode block, its size and the base register */
Signature · 1 line
1.8.0
maintainer Applied
#1 lore raw
Quoted 4 lines · Lars-Peter Clausen

When inserting a new register into a block at the lower end the present bitmap is currently shifted into the wrong direction. The effect of this is that the bitmap becomes corrupted and registers which are present might be reported as not present and vice versa.

Applied, thanks.

#2 lore raw
In reply to Lars-Peter Clausen
Quoted 10 lines · Lars-Peter Clausen

When inserting a new register into a block at the lower end the present bitmap is currently shifted into the wrong direction. The effect of this is that the bitmap becomes corrupted and registers which are present might be reported as not present and vice versa.

Fix this by shifting left rather than right.

Fixes 472fdec7380c("regmap: rbtree: Reduce number of nodes, take 2")

Thanks Lars! I confirm that this fixes the problem :).

Daniel.