]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme: Fix u32 overflow in the number of namespace list calculation
authorJaesoo Lee <jalee@purestorage.com>
Mon, 3 Jun 2019 23:42:28 +0000 (16:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:34:52 +0000 (11:34 +0800)
commitac4ff52d177195e7e8baff20164e8c3449b11372
tree7e8c191b30116bc80a99e084632d05dac0b856df
parentae4e62064756dba432c3691360ba80bba7a1191e
nvme: Fix u32 overflow in the number of namespace list calculation

[ Upstream commit c8e8c77b3bdbade6e26e8e76595f141ede12b692 ]

The Number of Namespaces (nn) field in the identify controller data structure is
defined as u32 and the maximum allowed value in NVMe specification is
0xFFFFFFFEUL. This change fixes the possible overflow of the DIV_ROUND_UP()
operation used in nvme_scan_ns_list() by casting the nn to u64.

Signed-off-by: Jaesoo Lee <jalee@purestorage.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c