DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Suanming Mou <suanmingm@nvidia.com>
Cc: Ori Kam <orika@nvidia.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	 Yuying Zhang <yuying.zhang@intel.com>,
	 "NBU-Contact-Thomas Monjalon (EXTERNAL)" <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@xilinx.com>,
	 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ray Kinsella <mdr@ashroe.eu>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v1] ethdev: add indirect action async query
Date: Thu, 17 Nov 2022 09:31:55 +0100	[thread overview]
Message-ID: <CAJFAV8y+saTsoXHXdaXVuz9FoA5i0nB5RQ2+VwUURiGH1W_iSw@mail.gmail.com> (raw)
In-Reply-To: <CO6PR12MB5396367FC543C8941C5CB5C4C1069@CO6PR12MB5396.namprd12.prod.outlook.com>

On Thu, Nov 17, 2022 at 9:18 AM Suanming Mou <suanmingm@nvidia.com> wrote:
>
> Hi,
>
> > -----Original Message-----
> > From: David Marchand <david.marchand@redhat.com>
> > Sent: Thursday, November 17, 2022 4:07 PM
> > To: Suanming Mou <suanmingm@nvidia.com>
> > Cc: Ori Kam <orika@nvidia.com>; Aman Singh <aman.deep.singh@intel.com>;
> > Yuying Zhang <yuying.zhang@intel.com>; NBU-Contact-Thomas Monjalon
> > (EXTERNAL) <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@xilinx.com>;
> > Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Ray Kinsella
> > <mdr@ashroe.eu>; dev@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@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


  reply	other threads:[~2022-11-17  8:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09 13:28 [RFC] " Suanming Mou
2022-08-15 12:01 ` Ori Kam
2022-09-20  7:11 ` [PATCH v1] " Suanming Mou
2022-09-28  8:50   ` Andrew Rybchenko
2022-11-17  8:06   ` David Marchand
2022-11-17  8:18     ` Suanming Mou
2022-11-17  8:31       ` David Marchand [this message]
2022-11-17  8:40         ` Suanming Mou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJFAV8y+saTsoXHXdaXVuz9FoA5i0nB5RQ2+VwUURiGH1W_iSw@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=aman.deep.singh@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@xilinx.com \
    --cc=mdr@ashroe.eu \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).