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 1A95845A4C; Sat, 28 Sep 2024 13:52:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94F214027A; Sat, 28 Sep 2024 13:52:56 +0200 (CEST) Received: from agw.arknetworks.am (agw.arknetworks.am [79.141.165.80]) by mails.dpdk.org (Postfix) with ESMTP id 3EF2540269 for ; Sat, 28 Sep 2024 13:52:55 +0200 (CEST) Received: from debian (unknown [78.109.73.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by agw.arknetworks.am (Postfix) with ESMTPSA id 93FE4E0C34; Sat, 28 Sep 2024 15:52:54 +0400 (+04) DKIM-Filter: OpenDKIM Filter v2.11.0 agw.arknetworks.am 93FE4E0C34 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arknetworks.am; s=default; t=1727524375; bh=5HyD++QD67roHp2Q7ImF5tMCCnalbBXswreyLQKA160=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=GUlyA+e9P7qhjrvXoIgpTlRPjPbZqbx7skSmwymYLZcRu7z9tHzMTs1onnSmwCXr7 3WhLFNEEpH8j8rWntxMjFHOkf2cOcaOAGDtGWihp4kYAX2yOx2TS+a8IOxcIOCUdN5 IJ/zXAS6Dwlyurama4cdSRmrRXlbaKFxOyTGvgO4ezMkinRLjyuFBz/stGMq/Jhxpv ZBfCSnzfsL7G7RHUuJKUvOSHpgEiSs8PjF6qaY8lszxqUvidIu1aNODpQdnCT9+UlL eAKtEwB45KN5+zY5vGaTTnoT9SrCmb6qECzWXQfRgvM4GNsSYcj4yJL5UbFvw9C4An b4BtApYMPBWYA== Date: Sat, 28 Sep 2024 15:52:44 +0400 (+04) From: Ivan Malov To: Stephen Hemminger cc: dev@dpdk.org, ivan.malov@oktetlabs.ru, Andrew Rybchenko , Andy Moreton Subject: Re: [PATCH 10/16] net/sfc: fix use-after-free warning messages In-Reply-To: <20240927204742.546164-11-stephen@networkplumber.org> Message-ID: <93601a51-7c39-d0d1-906c-7475b6560730@arknetworks.am> References: <20240927204742.546164-1-stephen@networkplumber.org> <20240927204742.546164-11-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed 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 Reviewed-by: Ivan Malov Thank you. On Fri, 27 Sep 2024, Stephen Hemminger wrote: > 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") > Cc: ivan.malov@oktetlabs.ru > Signed-off-by: Stephen Hemminger > --- > 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 > >