Re: [PATCH v3 3/7] cper: add helpers to handle Memory Error Section 2
From: Mark Brown
Date: Wed Nov 04 2026 - 12:31:39 EST
On Wed, Nov 04, 2026 at 12:03:11PM +0100, Pierre Gondois wrote:
> Add separate location and printing helpers for Memory Error
> Section 2:
> - cper_mem_err2_location()
> - cper_dimm_err2_location()
> - cper_print_mem2()
> +int cper_dimm_err2_location(const struct cper_sec_mem_err2 *mem, char *msg)
> +{
> + u32 len, n;
> + const char *bank = NULL, *device = NULL;
> +
> + if (!msg || !(mem->validation_bits & CPER_MEM2_VALID_MODULE_HANDLE))
> + return 0;
> +
> + /* SMBIOS handles are 16 bits; never truncate a Section 2 handle. */
> + if (mem->mem_dev_handle <= U16_MAX)
> + dmi_memdev_name(mem->mem_dev_handle, &bank, &device);
> + else
> + pr_warn(FW_WARN "Memory Error Section 2 module handle 0x%x exceeds SMBIOS range\n",
> + mem->mem_dev_handle);
Should this be rate limited?
> + len = CPER_REC_LEN;
> + if (bank && device)
> + n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
> + else
> + n = snprintf(msg, len,
> + "DIMM location: not present. DMI handle: 0x%.8x ",
> + mem->mem_dev_handle);
Shouldn't this be scnprintf(), especially in the first case where the
strings come from the firmware?
Attachment:
signature.asc
Description: PGP signature