]> git.baikalelectronics.ru Git - kernel.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)
committerSagi Grimberg <sagi@grimberg.me>
Thu, 6 Jun 2019 16:53:07 +0000 (09:53 -0700)
commite61543aed2eb833ab71c942566378e9d21c2521b
tree4208435720b69ba62d21bf61a95a149a3ce71893
parent1fb35d3b537e9a2767b7b3cb04d7520aee9c8a01
nvme: Fix u32 overflow in the number of namespace list calculation

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>
drivers/nvme/host/core.c