Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm cache policy smq: fix alloc_bitset check that always evaluates as false

static analysis by cppcheck has found a check on alloc_bitset that
always evaluates as false and hence never finds an allocation failure:

[drivers/md/dm-cache-policy-smq.c:1689]: (warning) Logical conjunction
always evaluates to false: !EXPR && EXPR.

Fix this by removing the incorrect mq->cache_hit_bits check

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Colin Ian King and committed by
Mike Snitzer
134bf30c 0a927c2f

+1 -1
+1 -1
drivers/md/dm-cache-policy-smq.c
··· 1686 1686 1687 1687 if (from_cblock(cache_size)) { 1688 1688 mq->cache_hit_bits = alloc_bitset(from_cblock(cache_size)); 1689 - if (!mq->cache_hit_bits && mq->cache_hit_bits) { 1689 + if (!mq->cache_hit_bits) { 1690 1690 DMERR("couldn't allocate cache hit bitset"); 1691 1691 goto bad_cache_hit_bits; 1692 1692 }