Fix off-by-one errors in log page fetching.

Signed-off-by: Jim Harris <james.r.harri@intel.com>
Change-Id: Iab15a1cef4ebcf4f217cbc70d716141af95367f8
This commit is contained in:
Jim Harris 2015-09-25 12:43:25 -07:00
parent 04b615bb1c
commit 004e4f6b59
2 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,7 @@ get_health_log_page(struct nvme_controller *ctrlr)
cmd.opc = NVME_OPC_GET_LOG_PAGE;
cmd.cdw10 = NVME_LOG_HEALTH_INFORMATION;
cmd.cdw10 |= (sizeof(*health_page) / 4) << 16; // number of dwords
cmd.cdw10 |= ((sizeof(*health_page) / 4) - 1) << 16; // number of dwords
cmd.nsid = NVME_GLOBAL_NAMESPACE_TAG;
return nvme_ctrlr_cmd_admin_raw(ctrlr, &cmd, health_page, sizeof(*health_page),

View File

@ -142,7 +142,7 @@ get_health_log_page(struct dev *dev)
cmd.opc = NVME_OPC_GET_LOG_PAGE;
cmd.cdw10 = NVME_LOG_HEALTH_INFORMATION;
cmd.cdw10 |= (sizeof(*(dev->health_page)) / 4) << 16; // number of dwords
cmd.cdw10 |= ((sizeof(*(dev->health_page)) / 4) - 1) << 16; // number of dwords
cmd.nsid = NVME_GLOBAL_NAMESPACE_TAG;
return nvme_ctrlr_cmd_admin_raw(dev->ctrlr, &cmd, dev->health_page, sizeof(*dev->health_page),