[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z89LcUIWO9m8Vtru@aschofie-mobl2.lan>
Date: Mon, 10 Mar 2025 13:28:33 -0700
From: Alison Schofield <alison.schofield@...el.com>
To: Shiju Jose <shiju.jose@...wei.com>
Cc: "linux-cxl@...r.kernel.org" <linux-cxl@...r.kernel.org>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"dave@...olabs.net" <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
"dave.jiang@...el.com" <dave.jiang@...el.com>,
"vishal.l.verma@...el.com" <vishal.l.verma@...el.com>,
"ira.weiny@...el.com" <ira.weiny@...el.com>,
"david@...hat.com" <david@...hat.com>,
"Vilas.Sridharan@....com" <Vilas.Sridharan@....com>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bp@...en8.de" <bp@...en8.de>,
"tony.luck@...el.com" <tony.luck@...el.com>,
"rafael@...nel.org" <rafael@...nel.org>,
"lenb@...nel.org" <lenb@...nel.org>,
"mchehab@...nel.org" <mchehab@...nel.org>,
"leo.duran@....com" <leo.duran@....com>,
"Yazen.Ghannam@....com" <Yazen.Ghannam@....com>,
"rientjes@...gle.com" <rientjes@...gle.com>,
"jiaqiyan@...gle.com" <jiaqiyan@...gle.com>,
"Jon.Grimm@....com" <Jon.Grimm@....com>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"naoya.horiguchi@....com" <naoya.horiguchi@....com>,
"james.morse@....com" <james.morse@....com>,
"jthoughton@...gle.com" <jthoughton@...gle.com>,
"somasundaram.a@....com" <somasundaram.a@....com>,
"erdemaktas@...gle.com" <erdemaktas@...gle.com>,
"pgonda@...gle.com" <pgonda@...gle.com>,
"duenwen@...gle.com" <duenwen@...gle.com>,
"gthelen@...gle.com" <gthelen@...gle.com>,
"wschwartz@...erecomputing.com" <wschwartz@...erecomputing.com>,
"dferguson@...erecomputing.com" <dferguson@...erecomputing.com>,
"wbs@...amperecomputing.com" <wbs@...amperecomputing.com>,
"nifan.cxl@...il.com" <nifan.cxl@...il.com>,
tanxiaofei <tanxiaofei@...wei.com>,
"Zengtao (B)" <prime.zeng@...ilicon.com>,
Roberto Sassu <roberto.sassu@...wei.com>,
"kangkang.shen@...urewei.com" <kangkang.shen@...urewei.com>,
wanghuiqiang <wanghuiqiang@...wei.com>,
Linuxarm <linuxarm@...wei.com>
Subject: Re: [PATCH 1/8] cxl: Add helper function to retrieve a feature entry
On Mon, Mar 10, 2025 at 06:15:38PM +0000, Shiju Jose wrote:
> >-----Original Message-----
> >From: Alison Schofield <alison.schofield@...el.com>
> >Sent: 07 March 2025 19:20
> >To: Shiju Jose <shiju.jose@...wei.com>
> [...]
> >> +struct cxl_feat_entry *cxl_get_feature_entry(struct cxl_dev_state *cxlds,
> >> + const uuid_t *feat_uuid)
> >> +{
> >> + struct cxl_features_state *cxlfs = to_cxlfs(cxlds);
> >> + struct cxl_feat_entry *feat_entry;
> >> + int count;
> >> +
> >> + /*
> >> + * Retrieve the feature entry from the supported features list,
> >> + * if the feature is supported.
> >> + */
> >> + feat_entry = cxlfs->entries->ent;
> >
> >Do we need some NULL checking here on cxlfs, entries
>
> Hi Alison,
>
> Thanks for the feedbacks.
> We had check on cxlfs before
> https://lore.kernel.org/all/20250122235159.2716036-5-dave.jiang@intel.com/
> but removed because of the following comment.
> https://lore.kernel.org/all/20250124150150.GZ5556@nvidia.com/
Hi Shiju,
I have not followed all along, so yeah my questions may be a bit pesky
at this point. I did see the comment linked above about how the driver
must be bound at this point. I think my question is a bit different.
Are each of these guaranteed not to be NULL here:
to_cxlfs(cxlds)
cxlfs->entries
cxlfs->entries->ent
If these cannot be NULL, then all good.
--Alison
> >
> >
> >> + for (count = 0; count < cxlfs->entries->num_features; count++,
> >> +feat_entry++) {
> >
> >Was num_features previously validated?
> Not in the caller. Had check for num_features here before in cxl_get_feature_entry()
> as seen in the above link.
> >
> >> + if (uuid_equal(&feat_entry->uuid, feat_uuid))
> >> + return feat_entry;
> >> + }
> >> +
> >> + return ERR_PTR(-ENOENT);
> >
> >Why not just return NULL?
> Will do.
> >
> >
> >> +}
> >> +
> >> size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid,
> >> enum cxl_get_feat_selection selection,
> >> void *feat_out, size_t feat_out_size, u16 offset,
> >> --
> >> 2.43.0
> >>
>
> Thanks,
> Shiju
>
Powered by blists - more mailing lists