]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commit
nvme: fix I/O queue length calculation overflow
authorMatt DeVillier <matt.devillier@puri.sm>
Tue, 21 Aug 2018 15:00:53 +0000 (10:00 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 23 Aug 2018 14:23:21 +0000 (10:23 -0400)
commit7961917493baedb0aafd41d88029ed610d0c433f
tree9b8438b1926789449e380512951e84ae01406899
parent95f850c2377968ad951121ceaab76d40a9eed593
nvme: fix I/O queue length calculation overflow

Commit cd47172 changed the I/O queue length calculation to use the
Maximum Queue Entries Supported (MQES) value from the capabilities
register, plus one, with a maximum value of NVME_PAGE_SIZE.

An unintended effect from this is that due to length being an unsigned
16-bit int, a MQES value of 0xFFFF yields a length of zero, resulting
in the queue allocation failing. Fix this by changing length to a u32.

TEST: build/boot on a Purism Librem13v2 with a MyDigitalSSD BPX NVMe
drive, which reports a MQES of 0xFFFF. Verify NVMe drive present in
boot menu and OS boots successfully.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
src/hw/nvme.c