[PATCH v2] eventdev/eth_rx: fix memory leak when token parsing finished
Kundapura, Ganapati
ganapati.kundapura at intel.com
Thu Feb 3 06:44:05 CET 2022
Hi Weighuo,
> -----Original Message-----
> From: Weiguo Li <liwg06 at foxmail.com>
> Sent: 03 February 2022 09:08
> To: Kundapura, Ganapati <ganapati.kundapura at intel.com>
> Cc: Jayatheerthan, Jay <jay.jayatheerthan at intel.com>; Naga Harish K, S V
> <s.v.naga.harish.k at intel.com>; dev at dpdk.org
> Subject: RE:[PATCH v2] eventdev/eth_rx: fix memory leak when token
> parsing finished
>
> Hi Ganapati,
>
> Thanks for your reminding.
>
> I'm a bit confused by "eth_dev_id validate" you metiond below.
> I'll post a new patch for your review if this make clear.
>
> Thanks,
> -Weiguo
>
> > ------------------ Original ------------------
> > From: "Kundapura, Ganapati" <ganapati.kundapura at intel.com>;
> > Date: Thu, Feb 3, 2022 00:47 AM
> > To: "Weiguo Li"<liwg06 at foxmail.com>;"Jayatheerthan,
> > Jay"<jay.jayatheerthan at intel.com>;
> > Cc: "Naga Harish K, S
> > V"<s.v.naga.harish.k at intel.com>;"dev at dpdk.org"<dev at dpdk.org>;
> > Subject: RE: [PATCH v2] eventdev/eth_rx: fix memory leak when token
> > parsing finished
> >
> > Hi Weiguo,
> > Also noticed that usage of macros like
> > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET and
> > RTE_ETH_VALID_PORTID_OR_ERR_RET to validate rx_adapter_id and
> eth_dev_id returns error bypassing the freeing of memory get from strdup()
> in error case.
> >
> > Thanks,
> > Ganapati
> > > > > token = strtok(l_params, ",");
> > > Validate token
> >
> > > > > /* Get device ID from parameter string */
> > > > > eth_dev_id = strtoul(token, NULL, 10);
> > > > > RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL);
> > > Use RTE_ETH_VALID_PORTID_OR_ERR_RET to validate eth_dev_id
>
> I looked up the macro defines:
> RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET -- use
> rte_event_pmd_is_valid_dev()
> RTE_ETH_VALID_PORTID_OR_ERR_RET -- use rte_eth_dev_is_valid_port()
>
> If you mean the validate of "eth_dev_id" here be replaced by
> rte_eth_dev_is_valid_port() ?
> or both rte_event_pmd_is_valid_dev() and rte_eth_dev_is_valid_port() used
> to do the validation?
>
>
rxa_validate_id() for validating rx_adapter_id and rte_eth_dev_is_valid_port() for
validating eth_dev_id.
More information about the dev
mailing list