[PATCH v1] ethdev: add indirect action async query
David Marchand
david.marchand at redhat.com
Thu Nov 17 09:31:55 CET 2022
On Thu, Nov 17, 2022 at 9:18 AM Suanming Mou <suanmingm at nvidia.com> wrote:
>
> Hi,
>
> > -----Original Message-----
> > From: David Marchand <david.marchand at redhat.com>
> > Sent: Thursday, November 17, 2022 4:07 PM
> > To: Suanming Mou <suanmingm at nvidia.com>
> > Cc: Ori Kam <orika at nvidia.com>; Aman Singh <aman.deep.singh at intel.com>;
> > Yuying Zhang <yuying.zhang at intel.com>; NBU-Contact-Thomas Monjalon
> > (EXTERNAL) <thomas at monjalon.net>; Ferruh Yigit <ferruh.yigit at xilinx.com>;
> > Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>; Ray Kinsella
> > <mdr at ashroe.eu>; dev at dpdk.org
> > Subject: Re: [PATCH v1] ethdev: add indirect action async query
> >
> > Hello,
> >
> > On Tue, Sep 20, 2022 at 9:12 AM Suanming Mou <suanmingm at nvidia.com>
> > wrote:
> > > @@ -2873,17 +2907,23 @@ port_queue_action_handle_destroy(portid_t
> > port_id,
> > > * of error.
> > > */
> > > memset(&error, 0x99, sizeof(error));
> > > + job = calloc(1, sizeof(*job));
> > > + if (!job) {
> > > + printf("Queue action destroy job allocate failed\n");
> > > + return -ENOMEM;
> > > + }
> > > + job->type = QUEUE_JOB_TYPE_ACTION_DESTROY;
> > > + job->pia = pia;
> > >
> > > if (pia->handle &&
> > > rte_flow_async_action_handle_destroy(port_id,
> > > - queue_id, &attr, pia->handle, NULL, &error)) {
> > > + queue_id, &attr, pia->handle, job, &error)) {
> > > ret = port_flow_complain(&error);
> > > continue;
> > > }
> > > *tmp = pia->next;
> > > printf("Indirect action #%u destruction queued\n",
> > > pia->id);
> > > - free(pia);
> > > break;
> > > }
> > > if (i == n)
> >
> > Our covscan tool reports a potential leak of "job" in this block.
> > I am unclear whether it is a normal occurence, but it seems that if
> > pia->handle == NULL, then job is leaked.
>
> OK, this function can only be called from destroying a created action handle. For the created action handle, the pia->handle should never be NULL here.
> And we also have " if (actions[i] != pia->id) " several lines above to ensure it is a valid pia.
> I agree from tools' point of view it looks like a leak here. But it should never happen.
> Do you think we need a "fix" in that case?
- If you are sure of it, unnecessary checks must be removed.
- In pia->handle != NULL branch, won't "job" be leaked too if
rte_flow_async_action_handle_destroy() fails?
--
David Marchand
More information about the dev
mailing list