summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2020-07-25 20:00:21 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-26 10:40:48 +0200
commitb40753984979b1cd61a19d91b2044dd15a816e9f (patch)
tree7c4e5373c117d8d2f64f1d06b64843ceb97e8f55 /fs/btrfs/super.c
parent9f4f7c08d50b202a9e4478762f464524215789a6 (diff)
bcache: avoid nr_stripes overflow in bcache_device_init()
[ Upstream commit 65f0f017e7be8c70330372df23bcb2a407ecf02d ] For some block devices which large capacity (e.g. 8TB) but small io_opt size (e.g. 8 sectors), in bcache_device_init() the stripes number calcu- lated by, DIV_ROUND_UP_ULL(sectors, d->stripe_size); might be overflow to the unsigned int bcache_device->nr_stripes. This patch uses the uint64_t variable to store DIV_ROUND_UP_ULL() and after the value is checked to be available in unsigned int range, sets it to bache_device->nr_stripes. Then the overflow is avoided. Reported-and-tested-by: Ken Raeburn <raeburn@redhat.com> Signed-off-by: Coly Li <colyli@suse.de> Cc: stable@vger.kernel.org Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783075 Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/btrfs/super.c')
0 files changed, 0 insertions, 0 deletions