提交 328f494d 编写于 作者: L Lars-Peter Clausen 提交者: Mark Brown

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: 472fdec7("regmap: rbtree: Reduce number of nodes, take 2")
Reported-by: NDaniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
上级 c517d838
......@@ -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 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册