RE: [PATCH v2] net/enic: check notify set return value during init

"Hyong Youb Kim (hyonkim)" <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <IA3PR11MB89877F0FA4E9EF63B478A201BFC42@IA3PR11MB8987.namprd11.prod.outlook.com>

> -----Original Message-----
> From: Alexey Simakov <[email protected]>
> Sent: Friday, July 17, 2026 6:23 PM
> To: Hyong Youb Kim (hyonkim) <[email protected]>
> Cc: John Daley (johndale) <[email protected]>; Neil Horman
> <[email protected]>; Sujith Sankar <[email protected]>; David
> Marchand <[email protected]>; [email protected]; [email protected]
> Subject: Re: [PATCH v2] net/enic: check notify set return value during init
> 
> Sure, also dpdk ai review higlightet potential problems in memory
> management
> 
> For example:
> 
> enic->cq = rte_zmalloc("enic_vnic_cq", sizeof(struct vnic_cq) *
> 			       enic->conf_cq_count, 8);
> enic->intr = rte_zmalloc("enic_vnic_intr", sizeof(struct vnic_intr) *
> 			enic->conf_intr_count, 8);
> enic->rq = rte_zmalloc("enic_vnic_rq", sizeof(struct vnic_rq) *
> 			enic->conf_rq_count, 8);
> enic->wq = rte_zmalloc("enic_vnic_wq", sizeof(struct vnic_wq) *
> 			enic->conf_wq_count, 8);
> 
> if (enic->conf_cq_count > 0 && enic->cq == NULL) {
> 	dev_err(enic, "failed to allocate vnic_cq, aborting.\n");
> 	return -1;
> }
> if (enic->conf_intr_count > 0 && enic->intr == NULL) {
> 	dev_err(enic, "failed to allocate vnic_intr, aborting.\n");
> 	return -1;
> }
> 
> Lets imagine that enic->cq is allocated successfully, after that
> when we trying to allocate enic->intr we are failing, so in this
> case we leaking in second if statement, this related to all error
> handling paths in driver, since as far as I understand resource
> free happening only in enic_dev_deinit(...) function.
> 
> So my question is it problem? If yes, should I address this issue
> in scope of my patch or better to make it in another?

Why don't you create one cleanup patch that addresses both issues,
since they are in the same function?

Thanks.
-Hyong
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.