[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <67ae381a.170a0220.362a2c.8f42@mx.google.com>
Date: Thu, 13 Feb 2025 10:21:06 -0800
From: Fan Ni <nifan.cxl@...il.com>
To: Yuquan Wang <wangyuquan1236@...tium.com.cn>
Cc: dave@...olabs.net, jonathan.cameron@...wei.com, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com,
ira.weiny@...el.com, dan.j.williams@...el.com,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] cxl/pmem: debug invalid serial number data
On Thu, Feb 13, 2025 at 02:40:08PM +0800, Yuquan Wang wrote:
> In a nvdimm interleave-set each device with an invalid or zero
> serial number may cause pmem region initialization to fail, but in
> cxl case such device could still set cookies of nd_interleave_set
> and create a nvdimm pmem region.
>
> This adds the validation of serial number in cxl pmem region creation.
> The event of no serial number would cause to fail to set the cookie
> and pmem region.
>
> Signed-off-by: Yuquan Wang <wangyuquan1236@...tium.com.cn>
> ---
> drivers/cxl/pmem.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/cxl/pmem.c b/drivers/cxl/pmem.c
> index f9c95996e937..89f4eac49313 100644
> --- a/drivers/cxl/pmem.c
> +++ b/drivers/cxl/pmem.c
> @@ -384,6 +384,13 @@ static int cxl_pmem_region_probe(struct device *dev)
> };
> info[i].offset = m->start;
> info[i].serial = cxlds->serial;
> +
> + if (info[i].serial == 0) {
> + dev_dbg(dev, "%s: invalid serial number\n",
Should we use dev_err() instead?
Fan
> + dev_name(&cxlmd->dev));
> + rc = -ENXIO;
> + goto out_nvd;
> + }
> }
> ndr_desc.num_mappings = cxlr_pmem->nr_mappings;
> ndr_desc.mapping = mappings;
> --
> 2.34.1
>
Powered by blists - more mailing lists