linux-uconsole/drivers/md/bcache
Coly Li 5a5649a421 bcache: explicity type cast in bset_bkey_last()
[ Upstream commit 7c02b0055f ]

In bset.h, macro bset_bkey_last() is defined as,
    bkey_idx((struct bkey *) (i)->d, (i)->keys)

Parameter i can be variable type of data structure, the macro always
works once the type of struct i has member 'd' and 'keys'.

bset_bkey_last() is also used in macro csum_set() to calculate the
checksum of a on-disk data structure. When csum_set() is used to
calculate checksum of on-disk bcache super block, the parameter 'i'
data type is struct cache_sb_disk. Inside struct cache_sb_disk (also in
struct cache_sb) the member keys is __u16 type. But bkey_idx() expects
unsigned int (a 32bit width), so there is problem when sending
parameters via stack to call bkey_idx().

Sparse tool from Intel 0day kbuild system reports this incompatible
problem. bkey_idx() is part of user space API, so the simplest fix is
to cast the (i)->keys to unsigned int type in macro bset_bkey_last().

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-24 08:34:53 +01:00
..
alloc.c bcache: fix deadlock in bcache_allocator 2019-12-31 16:36:02 +01:00
bcache.h bcache: add readahead cache policy options via sysfs interface 2020-02-11 04:34:08 -08:00
bset.c bcache: fix stack corruption by PRECEDING_KEY() 2019-06-19 08:18:00 +02:00
bset.h bcache: explicity type cast in bset_bkey_last() 2020-02-24 08:34:53 +01:00
btree.c bcache: at least try to shrink 1 node in bch_mca_scan() 2020-01-04 19:12:58 +01:00
btree.h bcache: fix race in btree_flush_write() 2019-09-16 08:22:23 +02:00
closure.c closures: fix a race on wakeup from closure_sync 2019-10-05 13:09:54 +02:00
closure.h
debug.c bcache: Fix an error code in bch_dump_read() 2020-01-27 14:51:09 +01:00
debug.h
extents.c bcache: treat stale && dirty keys as bad keys 2019-09-16 08:22:05 +02:00
extents.h
io.c bcache: ignore read-ahead request failure on backing device 2019-07-26 09:14:21 +02:00
journal.c bcache: fix race in btree_flush_write() 2019-09-16 08:22:23 +02:00
journal.h
Kconfig
Makefile
movinggc.c
request.c bcache: add readahead cache policy options via sysfs interface 2020-02-11 04:34:08 -08:00
request.h
stats.c
stats.h
super.c bcache: cached_dev_free needs to put the sb page 2020-02-24 08:34:51 +01:00
sysfs.c bcache: add readahead cache policy options via sysfs interface 2020-02-11 04:34:08 -08:00
sysfs.h bcache: improve sysfs_strtoul_clamp() 2019-04-05 22:33:09 +02:00
trace.c
util.c
util.h bcache: Revert "bcache: fix high CPU occupancy during journal" 2019-07-26 09:14:21 +02:00
writeback.c bcache: do not mark writeback_running too early 2019-12-05 09:20:07 +01:00
writeback.h bcache: never writeback a discard operation 2019-03-23 20:10:10 +01:00