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 9C9AE45A5D; Sun, 29 Sep 2024 17:42:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 50CF640672; Sun, 29 Sep 2024 17:41:35 +0200 (CEST) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 3C1D440615 for ; Sun, 29 Sep 2024 17:41:27 +0200 (CEST) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-718e285544fso2805174b3a.1 for ; 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=1727624486; x=1728229286; 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=AWtNO2OBtYWxx0dUrqnpcWt4hXt0bjrxhYc0+b3GRJQ=; b=r6KMzaXYsMY41mCTITWD7VPjcgO9ZGf+YWDoTL9l2H8rgRareYPKGXdUK0w+H/jCV8 8blN5lgysAUUfAPqBucomDyZGvkgUzcN6J/FAwYZW6kyAHSFHqsBBCKSoQZyY+z9oAmx 50lfnejmgsOA+8WjLKtq531IRx7xQvhax+QoJk/bt2p3Nhg8HFJdW7CcrfSaZjE10ELo TchxVCqtV6Ow0E8sJ0L1EMEAaGisxNKhHvxIHZ7YPLX4zDZETkuKY7NzyqH2Sy6WT/B+ f/+0WKrsY3I4cgqfJ2kYa/FalYZMhyUPp7Db08BbRA42E+UvVK8hzW7rketQojeQq8rx GfUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727624486; x=1728229286; 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=AWtNO2OBtYWxx0dUrqnpcWt4hXt0bjrxhYc0+b3GRJQ=; b=iJELV04BjOrF+nHz4yj+6ORBIe/+gzt7fnV2rGENpfziV2XAQ3b2MKqubNBWsnHhU5 qJ5lrNhKPcC38TxT5cigTrDr4/cFia668JpJrP9Z5KmrV6MTotwoIt5ezkPTtC7fBjkw AY9dsP9bHXJdx4Mmgh2KtMtndumflH3sOpX69Ul7wSV7HnvmmDu0NMoIUU7YiIXF3UPW zjRFIKu7fAWVrIT/vg/dcVyIiMBmcVaBwZ7GmWNp/oZz3rCSqVoMJGC7zzSBtikWA8Tu sJZHdAx1Jp8N3wIC2jwb8RhLuJwHG/pdY2xJP+U4iQyR1mxhVOeq9XzC/sh7uRTNfnTU rn1w== X-Gm-Message-State: AOJu0YwQ1jP6RtGA1ilOFRM3DnO3DuLS00r662bBO+CaiIVgc39B7HUR tLWfEZ2HTWx+071Pf4W52X5G/3/eaN2v6PbYp3ClFT7c7Fc320ahvKCPYRBIp2s/U9gDps/9S5l EZZ4= X-Google-Smtp-Source: AGHT+IG+qJKS6cuRyTv4LjGVQ5mETfUmOI+tfQ1lIx2tANjvO0E5lAn58JJpMB588oEITVhxz0AFKw== X-Received: by 2002:a05:6a00:9a1:b0:70d:2a88:a483 with SMTP id d2e1a72fcca58-71b25daa507mr16288601b3a.0.1727624486395; Sun, 29 Sep 2024 08:41:26 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Sep 2024 08:41:26 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Ivan Malov , Andrew Rybchenko , Andy Moreton Subject: [PATCH v3 09/18] net/sfc: fix use-after-free warning messages Date: Sun, 29 Sep 2024 08:34:34 -0700 Message-ID: <20240929154107.62539-10-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-Transfer-Encoding: 8bit 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 If compiler detection of use-after-free is enabled then this drivers debug messages will cause warnings. Change to move debug message before the object is freed. Bugzilla ID: 1551 Fixes: 55c1238246d5 ("net/sfc: add more debug messages to transfer flows") Signed-off-by: Stephen Hemminger Reviewed-by: Ivan Malov --- drivers/net/sfc/sfc_flow_rss.c | 4 ++-- drivers/net/sfc/sfc_mae.c | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/net/sfc/sfc_flow_rss.c b/drivers/net/sfc/sfc_flow_rss.c index e28c943335..8e2749833b 100644 --- a/drivers/net/sfc/sfc_flow_rss.c +++ b/drivers/net/sfc/sfc_flow_rss.c @@ -303,9 +303,9 @@ sfc_flow_rss_ctx_del(struct sfc_adapter *sa, struct sfc_flow_rss_ctx *ctx) TAILQ_REMOVE(&flow_rss->ctx_list, ctx, entries); rte_free(ctx->qid_offsets); - rte_free(ctx); - sfc_dbg(sa, "flow-rss: deleted ctx=%p", ctx); + + rte_free(ctx); } static int diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 60ff6d2181..8f74f10390 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -400,9 +400,8 @@ sfc_mae_outer_rule_del(struct sfc_adapter *sa, efx_mae_match_spec_fini(sa->nic, rule->match_spec); TAILQ_REMOVE(&mae->outer_rules, rule, entries); - rte_free(rule); - sfc_dbg(sa, "deleted outer_rule=%p", rule); + rte_free(rule); } static int @@ -585,9 +584,8 @@ sfc_mae_mac_addr_del(struct sfc_adapter *sa, struct sfc_mae_mac_addr *mac_addr) } TAILQ_REMOVE(&mae->mac_addrs, mac_addr, entries); - rte_free(mac_addr); - sfc_dbg(sa, "deleted mac_addr=%p", mac_addr); + rte_free(mac_addr); } enum sfc_mae_mac_addr_type { @@ -785,10 +783,10 @@ sfc_mae_encap_header_del(struct sfc_adapter *sa, } TAILQ_REMOVE(&mae->encap_headers, encap_header, entries); + sfc_dbg(sa, "deleted encap_header=%p", encap_header); + rte_free(encap_header->buf); rte_free(encap_header); - - sfc_dbg(sa, "deleted encap_header=%p", encap_header); } static int @@ -983,9 +981,8 @@ sfc_mae_counter_del(struct sfc_adapter *sa, struct sfc_mae_counter *counter) } TAILQ_REMOVE(&mae->counters, counter, entries); - rte_free(counter); - sfc_dbg(sa, "deleted counter=%p", counter); + rte_free(counter); } static int @@ -1165,9 +1162,8 @@ sfc_mae_action_set_del(struct sfc_adapter *sa, sfc_mae_mac_addr_del(sa, action_set->src_mac_addr); sfc_mae_counter_del(sa, action_set->counter); TAILQ_REMOVE(&mae->action_sets, action_set, entries); - rte_free(action_set); - sfc_dbg(sa, "deleted action_set=%p", action_set); + rte_free(action_set); } static int @@ -1401,10 +1397,10 @@ sfc_mae_action_set_list_del(struct sfc_adapter *sa, sfc_mae_action_set_del(sa, action_set_list->action_sets[i]); TAILQ_REMOVE(&mae->action_set_lists, action_set_list, entries); + sfc_dbg(sa, "deleted action_set_list=%p", action_set_list); + rte_free(action_set_list->action_sets); rte_free(action_set_list); - - sfc_dbg(sa, "deleted action_set_list=%p", action_set_list); } static int @@ -1667,9 +1663,8 @@ sfc_mae_action_rule_del(struct sfc_adapter *sa, sfc_mae_outer_rule_del(sa, rule->outer_rule); TAILQ_REMOVE(&mae->action_rules, rule, entries); - rte_free(rule); - sfc_dbg(sa, "deleted action_rule=%p", rule); + rte_free(rule); } static int -- 2.45.2