> -----Original Message-----
> From: Linux-nvdimm [mailto:[email protected]] On Behalf Of 
> Dave Jiang
> Sent: Tuesday, July 17, 2018 3:54 PM
> Subject: [PATCH v5 03/12] nfit/libnvdimm: store dimm id as a member to struct 
> nvdimm
...
> +     if (dcr->valid_fields & ACPI_NFIT_CONTROL_MFG_INFO_VALID)
> +             sprintf(nfit_mem->id, "%04x-%02x-%04x-%08x",
> +                             be16_to_cpu(dcr->vendor_id),
> +                             dcr->manufacturing_location,
> +                             be16_to_cpu(dcr->manufacturing_date),
> +                             be32_to_cpu(dcr->serial_number));
> +     else
> +             sprintf(nfit_mem->id, "%04x-%08x",
> +                             be16_to_cpu(dcr->vendor_id),
> +                             be32_to_cpu(dcr->serial_number));
...
> 
> +#define NFIT_DIMM_ID_LEN     25
> +     char id[NFIT_DIMM_ID_LEN];

Since the longest ID is:
    4+2+4+8 hex characters = 18 bytes
    +3 dashes = 21 bytes
    +1 NULL = 22 bytes,

why is the define 25?

Same question for this define in patch 02/12 (although there's another comment
by Eric Biggers that this isn't really used, so this might be moot):
> +#define NVDIMM_KEY_DESC_LEN          25


---
Robert Elliott, HPE Persistent Memory




_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to