From: Tomas Bzatek Date: Fri, 5 Jan 2024 13:42:11 +0000 (+0100) Subject: nbft: Fix (struct nbft_info_subsystem_ns).num_hfis off-by-one X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=220e8872f8e1c9e8c7fee35180bb572dc6f6c686;p=users%2Fsagi%2Flibnvme.git nbft: Fix (struct nbft_info_subsystem_ns).num_hfis off-by-one The num_hfis field only reflected the number of Secondary HFI Associations, resulting in the last parsed HFI being ignored by users (nvme-cli). According to the NVM Express Boot Specification, Revision 1.0, the Primary HFI Descriptor Index in the Subsystem Namespace (SSNS) Descriptor contains this note: "If multiple HFIs are associated with this record, subsequent interfaces should be populated in the Secondary HFI Associations field." As both the primary and secondary HFIs are parsed into a single array, it makes sense to reflect the proper number of elements. Signed-off-by: Tomas Bzatek --- diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c index 2c870880..06632323 100644 --- a/src/nvme/nbft.c +++ b/src/nvme/nbft.c @@ -274,6 +274,7 @@ static int read_ssns(struct nbft_info *nbft, ret = -EINVAL; goto fail; } + ssns->num_hfis = 1; for (i = 0; i < le16_to_cpu(raw_ssns->secondary_hfi_assoc_obj.length); i++) { ssns->hfis[i + 1] = hfi_from_index(nbft, ss_hfi_indexes[i]); if (ss_hfi_indexes[i] && !ssns->hfis[i + 1])