]> git.hungrycats.org Git - linux/commitdiff
regmap: regcache-rbtree: Fix present bitmap resize
authorLars-Peter Clausen <lars@metafoo.de>
Sat, 7 Mar 2015 16:10:01 +0000 (17:10 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Fri, 17 Apr 2015 00:11:28 +0000 (20:11 -0400)
[ Upstream commit 328f494d95aac8bd4896aea2328bc281053bcb71 ]

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")
Reported-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/base/regmap/regcache-rbtree.c

index f3e8fe0cc65030a8fea51c00994a343df8220659..9d09c5bb5874a46592ad2f0d87d1bcc5fb8d0552 100644 (file)
@@ -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 */