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 19E7DA00C3; Sun, 27 Feb 2022 06:25:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03B174068F; Sun, 27 Feb 2022 06:25:42 +0100 (CET) Received: from out162-62-57-64.mail.qq.com (out162-62-57-64.mail.qq.com [162.62.57.64]) by mails.dpdk.org (Postfix) with ESMTP id 4203A40683 for ; Sun, 27 Feb 2022 06:25:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1645939538; bh=x2p2QFz99EdW4RXl2bQozvsXBbpcxtiFTw8BtDxbn6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ll1o8eZKGzVhbiqkf6RO8C32JB6MNH3FSizO5FpCStqeHzukp8TKlkKgTMaHSS/02 3q9psyscGlBL81ecgDaOeWITzroXVnTOI0sQER8gmgLrfmv6Rdi1fSgas4hEvsmutF fBLCzDdy3poGU29PmrM52LbgSHuRwMFYGUg003Ms= Received: from localhost.localdomain ([111.193.130.237]) by newxmesmtplogicsvrsza5.qq.com (NewEsmtp) with SMTP id 656A1443; Sun, 27 Feb 2022 13:25:22 +0800 X-QQ-mid: xmsmtpt1645939522tyj2z0yjk Message-ID: X-QQ-XMAILINFO: Ne9q9v6AFM79Z0JiIuj2r6ZE815J7PQdiBEK4HNfAJnkRw/Pl67t3KlLxk1RmR 0FRcc9mmOteyX5ol575Fw2sBoZSvbkpaVHZ8OLoR+tbUOYxWwuT55EHhSIxRp3fhTbvQxn6YsoNR zAL8zg4XBD7CqCXEM/FfV6y4kusJB9hNGlykmStdZoEPj/Xi+j9zL6NlPkY/Tpm1VsDAH9O0W6aT DkYOkI2MpzjX1AWlnxgR3cLqfgkIXG+YCuxBG82vUySh6STegL1U60roPizOCs0cMFYhdBjN39vF WakDQjb87+Us7L3Z2HcfofXyqvUHagJEAUpyPkUA0DSdMdZs0rT/f4C+J9uoV9O5mkxUNgfDsyL4 y6Btmco/B/hwon0BqnzvHLEe4t5R82CYRbCg5WtMA1tDe1dJhqSrWC+dROY54gaVZ/UEnKBdJIZz Fbtw2zm8CGnKd+mn8HBvQYkKo8ekAODt0riXonPYxo35Y7L1h8XzsiX/Ulwt+tMqnQ6rY5Mt9aR3 vBZSpK6X/pLWi4VPkslPcq2XExesG/W7RxWmM3IfhFGkYca9/AJi0fNayXt+v95c3pbfvGJVo13E s08u1KxiksqZDLn9p3wqZ4H4p4Jfa1eTexKSXmOWGbkJtF8Ha4j5xRkiYHfOUE1aiYi5kIePIrMC dnaNgsHvl/c/9RGhc9SNnO0pXKB3LxN8DE+6BmPTMOrSy8AEcPAQRUE1aHRLshr8NW6xgtcoo7WD ZG5NbTI91ADOa/RrXQMAcl8S7+QrXUuKdEFeI/7ncE1WBUTgLODL4mYHFRnAFW3MRZMoocmqvkx2 DQ5IR5zUJhzITBws3xpQ2Yp0H85xIsPMaZ0pTwLZYp4qe79rzP7gbmDOhY6QKZMTIQjdBu7rfJjd nfP3RrJsRsUxYR+1TACBDedBg2nt6fINWQ0/cNfAPGGSNf1+dMYvoFjBIxo+HOew1aRWobh4Mv From: Weiguo Li To: cristian.dumitrescu@intel.com Cc: wojciechx.liguzinski@intel.com, stephen@networkplumber.org, dev@dpdk.org Subject: [PATCH v2] sched: remove useless malloc in pie data init Date: Sun, 27 Feb 2022 13:25:22 +0800 X-OQ-MSGID: <20220227052522.375708-1-liwg06@foxmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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 'rte_pie_rt_data_init(NULL)' is not expected, and it's ought to fail when this happen. The malloc inside this funtion didn't work. So remove the malloc otherwise will lead to a memory leak. Fixes: 44c730b0e37971 ("sched: add PIE based congestion management") Signed-off-by: Weiguo Li --- v2: * revise according to Stephen's suggestion. --- lib/sched/rte_pie.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c index cdb7bab697..eed5c12b54 100644 --- a/lib/sched/rte_pie.c +++ b/lib/sched/rte_pie.c @@ -15,13 +15,8 @@ int rte_pie_rt_data_init(struct rte_pie *pie) { if (pie == NULL) { - /* Allocate memory to use the PIE data structure */ - pie = rte_malloc(NULL, sizeof(struct rte_pie), 0); - - if (pie == NULL) - RTE_LOG(ERR, SCHED, "%s: Memory allocation fails\n", __func__); - - return -1; + RTE_LOG(ERR, SCHED, "%s: Invalid addr for pie\n", __func__); + return -EINVAL; } pie->active = 0; -- 2.25.1