nvme: fix max_segments integer truncation
authorChristoph Hellwig <[email protected]>
Wed, 2 Mar 2016 17:07:12 +0000 (18:07 +0100)
committerJens Axboe <[email protected]>
Thu, 3 Mar 2016 21:43:10 +0000 (14:43 -0700)
commit45686b6198bd824f083ff5293f191d78db9d708a
tree5c752a162d53af164942242d217d4cf54a98afd8
parentda35825d9a091a7a1d5824c8468168e2658333ff
nvme: fix max_segments integer truncation

The block layer uses an unsigned short for max_segments.  The way we
calculate the value for NVMe tends to generate very large 32-bit values,
which after integer truncation may lead to a zero value instead of
the desired outcome.

Signed-off-by: Christoph Hellwig <[email protected]>
Reported-by: Jeff Lien <[email protected]>
Tested-by: Jeff Lien <[email protected]>
Reviewed-by: Keith Busch <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
drivers/nvme/host/core.c