]> git.baikalelectronics.ru Git - kernel.git/commit
bcache: not use hard coded memset size in bch_cache_accounting_clear()
authorColy Li <colyli@suse.de>
Sat, 9 Feb 2019 04:52:54 +0000 (12:52 +0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 9 Feb 2019 14:18:31 +0000 (07:18 -0700)
commitd0fa477b85430407c71f6d09ac128200f2c6a8e2
treecfef8628087b108de2e1c8bbf82fabfaa92b3cc9
parentb495c79cba162148c41c0e344ce370624a7fbcd5
bcache: not use hard coded memset size in bch_cache_accounting_clear()

In stats.c:bch_cache_accounting_clear(), a hard coded number '7' is
used in memset(). It is because in struct cache_stats, there are 7
atomic_t type members. This is not good when new members added into
struct stats, the hard coded number will only clear part of memory.

This patch replaces 'sizeof(unsigned long) * 7' by more generic
'sizeof(struct cache_stats))', to avoid potential error if new
member added into struct cache_stats.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/stats.c