Skip to content

Commit e7e79cb

Browse files
committed
util: Add feature length for host memory buffer
Without this the command "nvme get-feature /dev/nvme0 -H -f 0x0d" segfaults because it retrieves no data but tries to use it in nvme_show_host_mem_buffer()
1 parent 3f0bff8 commit e7e79cb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/nvme/util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ int nvme_get_feature_length(int fid, __u32 cdw11, __u32 *len)
435435
case NVME_FEAT_FID_HOST_ID:
436436
*len = (cdw11 & 0x1) ? 16 : 8;
437437
break;
438+
case NVME_FEAT_FID_HOST_MEM_BUF:
439+
*len = sizeof(struct nvme_host_mem_buf_attrs);
440+
break;
438441
case NVME_FEAT_FID_ARBITRATION:
439442
case NVME_FEAT_FID_POWER_MGMT:
440443
case NVME_FEAT_FID_TEMP_THRESH:
@@ -445,7 +448,6 @@ int nvme_get_feature_length(int fid, __u32 cdw11, __u32 *len)
445448
case NVME_FEAT_FID_IRQ_CONFIG:
446449
case NVME_FEAT_FID_WRITE_ATOMIC:
447450
case NVME_FEAT_FID_ASYNC_EVENT:
448-
case NVME_FEAT_FID_HOST_MEM_BUF:
449451
case NVME_FEAT_FID_KATO:
450452
case NVME_FEAT_FID_HCTM:
451453
case NVME_FEAT_FID_NOPSC:

0 commit comments

Comments
 (0)