From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B96FA00C2; Thu, 17 Nov 2022 09:32:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3546040DDC; Thu, 17 Nov 2022 09:32:13 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id E1E3340DDA for ; Thu, 17 Nov 2022 09:32:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668673931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YG6SYif+xDBuXc4oWaYUKbUXJy9/Lk9DZ0n5OluWz2k=; b=aeGLf0bDSsOjyCpi2tyIrd588FTSOQf7SzWbWY/JPpqG5/jN0ZI2ieM/xvi5ZclxeT4PiY KeCo3wxMoIIJBZhXWecgRiXAtVSleACVN3Rga7pStbZHTSyd9k/MR/gDGv/zMb6XKmfY+t v+3qXfTe4CqAegwqpiyloyJ04/Zu6hg= Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-433-HKzCxa8fOSuMLGx9YYiKDg-1; Thu, 17 Nov 2022 03:32:07 -0500 X-MC-Unique: HKzCxa8fOSuMLGx9YYiKDg-1 Received: by mail-pf1-f197.google.com with SMTP id cj8-20020a056a00298800b0056cee8a0cf8so800927pfb.9 for ; Thu, 17 Nov 2022 00:32:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YG6SYif+xDBuXc4oWaYUKbUXJy9/Lk9DZ0n5OluWz2k=; b=qhQUXnm4Clrh5uITRowTaZSPCyZLK31Mp2S3lpCtAS0goy9OycMjaNFdFr3hBD/k2x nKvw5iYnpf12vvSEQT9+QRFShNN+wHrczZKPo/HvGBbxtBqflz47Mh/AgA1maAQ0YV0M CHawWTHDF4u24IltWV6Ysk7g/3/1qz6I0Jnr1Qk4V6YGpj84DhBQcRsKFyuAt/TKDfJz CS9vTVwS4sDLLpGBwg3PTtoZ86zOsRIWu5PpINccQPxwL2/Au0JqaUCsL8u0DQMd6eVZ hRLQOf/1nJwy+sSYGS+5YPOacIkyD7Y2QebzDowcDeLDGNv2sG8v9zw3kvQ2n2KlYaVL hfSQ== X-Gm-Message-State: ANoB5pnPqjDf4lCZn1iRksivng+OBtEyQCVVplTaPaFvfh8tuKSxbWEE 3cinsyHZ+YzLmSzvvCblvFHd5PbpHjGwRPDjYm2/7a7PzeYeRRyNhAg30Yyibc/+ldwBjBhmh2g SqF7ngZHMUUlgqspopak= X-Received: by 2002:a63:2163:0:b0:474:d6fa:f574 with SMTP id s35-20020a632163000000b00474d6faf574mr1168552pgm.190.1668673926780; Thu, 17 Nov 2022 00:32:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf5jhRF+YZwQCljSbbYNgT0vN64eDArGvOlJArhKXEXVTmvmAGHPk3Db9935iqhNBeQvhjge97sZYzpLtkcB2/I= X-Received: by 2002:a63:2163:0:b0:474:d6fa:f574 with SMTP id s35-20020a632163000000b00474d6faf574mr1168533pgm.190.1668673926513; Thu, 17 Nov 2022 00:32:06 -0800 (PST) MIME-Version: 1.0 References: <20220809132824.25890-1-suanmingm@nvidia.com> <20220920071141.21769-1-suanmingm@nvidia.com> In-Reply-To: From: David Marchand Date: Thu, 17 Nov 2022 09:31:55 +0100 Message-ID: Subject: Re: [PATCH v1] ethdev: add indirect action async query To: Suanming Mou Cc: Ori Kam , Aman Singh , Yuying Zhang , "NBU-Contact-Thomas Monjalon (EXTERNAL)" , Ferruh Yigit , Andrew Rybchenko , Ray Kinsella , "dev@dpdk.org" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Nov 17, 2022 at 9:18 AM Suanming Mou wrote: > > Hi, > > > -----Original Message----- > > From: David Marchand > > Sent: Thursday, November 17, 2022 4:07 PM > > To: Suanming Mou > > Cc: Ori Kam ; Aman Singh ; > > Yuying Zhang ; NBU-Contact-Thomas Monjalon > > (EXTERNAL) ; Ferruh Yigit ; > > Andrew Rybchenko ; Ray Kinsella > > ; 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 > > 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