From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 1DD8245A5D;
	Sun, 29 Sep 2024 17:42:32 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 41AB440695;
	Sun, 29 Sep 2024 17:41:37 +0200 (CEST)
Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com
 [209.85.210.174])
 by mails.dpdk.org (Postfix) with ESMTP id 0D4F840648
 for <dev@dpdk.org>; Sun, 29 Sep 2024 17:41:28 +0200 (CEST)
Received: by mail-pf1-f174.google.com with SMTP id
 d2e1a72fcca58-718e285544fso2805178b3a.1
 for <dev@dpdk.org>; Sun, 29 Sep 2024 08:41:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1727624487;
 x=1728229287; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=5rIUygztSKBo8hXRl59YcTQfr34c1sPRuIObTaqdxdQ=;
 b=aiSVwER62grM1ENRimTK47Ops/cJ+4a41Y+OKl/3IC8OW0/TxoSpooENa6mRLGnEh4
 EJkMgD5XydGGhLS7HBdvaEycukQJdFi0ddhZSCiBIAAXKyOSBAmECko3gvltUwu9dyEN
 dNtEv4L0kipvnN59Y0tnR6NdvXqHFJKO2tFSsF6YQlx/QVm1fJMndZg+LAsjHDx+OPo6
 uALp3VVX0V7enr9XGv1EpKOCbNpnEKTN/j88kh0k8O54kL6X0/2giKTbo8snXvtPZrzG
 4zRNxdGeXcU7rvx7nN1hyiof1qczJ+lquiD/L0O/bzsODrnS8mL6KQy3fSrLIQRGGdAp
 ru5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727624487; x=1728229287;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=5rIUygztSKBo8hXRl59YcTQfr34c1sPRuIObTaqdxdQ=;
 b=pWmakrR5epewMhLtovw3jqPqSixZzbmEdhWRREi0NUt4feXpxZJjTF93+9OUerVFPP
 BYKIlg3BG9Lbb+jrjkSFj2JfV8GKVHRuSNaAePwEZ2VYdIx0qE1nlOEzYtgVXPdF9zLB
 XyKMn9Niz9TQbFMCuyWas6sn8pit/7FCqG8Tg3/N6lZxOKMnNS8VhBfA9PSrp4krgBKs
 LjEd1yv1ZJ9yesiBiVDX4zgc4KcdbCklIoJyTyfVPRZyfP6x9EK85/3en6JQB2mrOYZI
 7sbOTtWzT2diG+quiC82aFZsSm2Y5QsO/fNXV5OfLrSVQBNhhe5n+XW+7Q8YayBpZV48
 DLhg==
X-Gm-Message-State: AOJu0Ywzgzvip+RnIlXRALUHzraukfTa06EKl9VjIa19DPbVrf/jx4kS
 Weqa3amI2Rji3u/gNSxpC6euTGmQBkt5KAjYOGkG8DDNS7wPuSqx1iwbAWzHszJYXSH+T18HnTh
 tw+I=
X-Google-Smtp-Source: AGHT+IF/6iZOlwdrUIVFKBahBTmjaDnyqYgjWx/cs3P2Szp8jZ8qLPMgW85auva+Z1ddNEBblsAB5g==
X-Received: by 2002:a05:6300:668a:b0:1d2:bb49:636e with SMTP id
 adf61e73a8af0-1d4fa7ae30bmr17197450637.35.1727624487218; 
 Sun, 29 Sep 2024 08:41:27 -0700 (PDT)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71b2649c775sm4707416b3a.29.2024.09.29.08.41.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 29 Sep 2024 08:41:26 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, wenjing.qiao@intel.com,
 stable@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [PATCH v3 10/18] net/cpfl: fix free of nonheap object
Date: Sun, 29 Sep 2024 08:34:35 -0700
Message-ID: <20240929154107.62539-11-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20240929154107.62539-1-stephen@networkplumber.org>
References: <20240927204742.546164-1-stephen@networkplumber.org>
 <20240929154107.62539-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

With proper annotation, GCC discovers that this driver is
calling rte_free() on an object that was not allocated
(it is part of array in another object).

In function ‘cpfl_flow_js_mr_layout’,
    inlined from ‘cpfl_flow_js_mr_action’ at ../drivers/net/cpfl/cpfl_flow_parser.c:848:9,
    inlined from ‘cpfl_flow_js_mod_rule’ at ../drivers/net/cpfl/cpfl_flow_parser.c:908:9,
    inlined from ‘cpfl_parser_init’ at ../drivers/net/cpfl/cpfl_flow_parser.c:932:8,
    inlined from ‘cpfl_parser_create’ at ../drivers/net/cpfl/cpfl_flow_parser.c:959:8:
../drivers/net/cpfl/cpfl_flow_parser.c:740:9: warning: ‘rte_free’ called on pointer ‘*parser.modifications’ with nonzero offset [28, 15479062120396] [-Wfree-nonheap-object]
  740 |         rte_free(js_mod->layout);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 6cc97c9971d7 ("net/cpfl: build action mapping rules from JSON")
Cc: wenjing.qiao@intel.com
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/cpfl/cpfl_flow_parser.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/cpfl/cpfl_flow_parser.c b/drivers/net/cpfl/cpfl_flow_parser.c
index 40569ddc6f..30abaad7c8 100644
--- a/drivers/net/cpfl/cpfl_flow_parser.c
+++ b/drivers/net/cpfl/cpfl_flow_parser.c
@@ -737,7 +737,6 @@ cpfl_flow_js_mr_layout(json_t *ob_layouts, struct cpfl_flow_js_mr_action_mod *js
 	return 0;
 
 err:
-	rte_free(js_mod->layout);
 	return -EINVAL;
 }
 
-- 
2.45.2