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 C7D70460FF; Thu, 23 Jan 2025 17:30:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF41940BA5; Thu, 23 Jan 2025 17:30:23 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id AE0454028A for ; Thu, 23 Jan 2025 17:30:19 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-219f8263ae0so22139095ad.0 for ; Thu, 23 Jan 2025 08:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649819; x=1738254619; 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=F/2Td6ymN4EIDmZG5UrIJkiV/qYh6KN76vLUNkCXvLI=; b=a1ldgaOZudqkg2i5JrT0C1ezouz2QWpTxqwXCgVvFD7VRA8WZ9HoVu5cwOHYYT427N avKv+bfKsb8QWsDCSQE3mgw96cFPTD3NxBI3gVG1wyrecY1tHxPSCzuEbPod1GJ02VUI gbT7JkX+9CS2q28eMtSHehzpizsuGlin062X9OYqfOLLR1FWjSHpTeNtyGgeq6oZz06F ZdzhmDVBemCtIdM2WCqwnmmLD69Tcj1yredqq690mDu7dbskw239gzvyP17Ow1vHMeKH lzhrImLzvsuNq/qqcrRXaTxSMO4/SsORXDSoTIYMCO93HbsQSwlQVQvfIrba9AgVXCtp L6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649819; x=1738254619; 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=F/2Td6ymN4EIDmZG5UrIJkiV/qYh6KN76vLUNkCXvLI=; b=VfOgP2vvQ/ty4ntmPX9tIKfk1xZlATN+NjsDer/hW9fbjFQ9UeqFWhiInlWApaPuRL pMxDOMnDPJj7IJDWLmN2fQdrA8RvxJLDoklj5J2aBS8UI+S0Sla3Pw8BGw7nLOuQRXnK qV41fm8TTWLhuL6y9Xzx8WHzWwkE2o7yI4MI/pUq06SPysdixzSNvMoQX+mXeIoX803K V59f/eIyFvH4DhYhrcqCk+7XpNv5OY8nJ7t12hDLGLF/we53bLD+JP+G5rQ4oQ5x7dTu pZDoUe/x2g/vRnOrXhXsSto1jjU+TrnuSzH+yPkElYKOoKJY+8KdkQE3eXWscrNLK1XE 2r+A== X-Gm-Message-State: AOJu0Yz2DWu2EMbSbyqbK2hJV7hWSQoHXJ4OTP+20Cd2trSP0UtwHuqn 4c8MUxJNQvrEHmehWTlWCmUtpEPYO/DhCPcGkyk26Yr79yBLYuNceSSmeJyS/x0nSKp0BcJuz35 k X-Gm-Gg: ASbGncvwOWnycg6pAAE1IRpzhPKHD9UvOc9T+1JSW8ubBfguTW1Evh5pr+iRbq6vIz/ Xsi+tl3hzmPer1LWJa+WO297atkdMUnuDDx12PBQ2PUz+YJrBjzOJ3P1D9pZAFKcz87PojkYW1j dlfjkI/2RIo13OCxgcwfm6WuRuEUBjcbqgY3MXR/Wb89EQBBPOj0V7Gm3gsmeY9aZ8bUp9Yaql/ ONaKAKk5pMtpPCa+yZmmicyzKE9aJI8HAtbC9dPZd5rQNoYUsUc1it61zD9DJOlf57YF6YrhX13 8Rp4fKYSgSnfpCC4NHaBP6DVNWko1Ar5///ogreIUwENFR267PqXzlzuhw== X-Google-Smtp-Source: AGHT+IE5pDCTR+ESmEWB2R8P6xr7BukL0mPt/3eibOOoyY4Oz8MeVXiD8mQLpz9LiKCnj7EjTg6+9w== X-Received: by 2002:a17:903:1c4:b0:216:31c2:3db8 with SMTP id d9443c01a7336-21c355c3358mr396941895ad.37.1737649818771; Thu, 23 Jan 2025 08:30:18 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac4907f076dsm64601a12.37.2025.01.23.08.30.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:18 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Vladimir Medvedkin Subject: [PATCH v3 02/15] rib: annotate rib allocation functions Date: Thu, 23 Jan 2025 08:28:02 -0800 Message-ID: <20250123163003.23394-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123163003.23394-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-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 Add function attributes to catch cases where rib is allocated and not freed correctly. Signed-off-by: Stephen Hemminger --- lib/rib/rte_rib.h | 24 +++++++++++++----------- lib/rib/rte_rib6.h | 24 +++++++++++++----------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/rib/rte_rib.h b/lib/rib/rte_rib.h index 2054d3cebd..f30b85d79a 100644 --- a/lib/rib/rte_rib.h +++ b/lib/rib/rte_rib.h @@ -230,6 +230,17 @@ rte_rib_get_nh(const struct rte_rib_node *node, uint64_t *nh); int rte_rib_set_nh(struct rte_rib_node *node, uint64_t nh); + +/** + * Free an RIB object. + * + * @param rib + * RIB object handle created with rte_rib_create(). + * If rib is NULL, no operation is performed. + */ +void +rte_rib_free(struct rte_rib *rib); + /** * Create RIB * @@ -245,7 +256,8 @@ rte_rib_set_nh(struct rte_rib_node *node, uint64_t nh); */ struct rte_rib * rte_rib_create(const char *name, int socket_id, - const struct rte_rib_conf *conf); + const struct rte_rib_conf *conf) + __rte_malloc __rte_dealloc(rte_rib_free, 1); /** * Find an existing RIB object and return a pointer to it. @@ -259,16 +271,6 @@ rte_rib_create(const char *name, int socket_id, struct rte_rib * rte_rib_find_existing(const char *name); -/** - * Free an RIB object. - * - * @param rib - * RIB object handle created with rte_rib_create(). - * If rib is NULL, no operation is performed. - */ -void -rte_rib_free(struct rte_rib *rib); - #ifdef __cplusplus } #endif diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h index a60756f798..d9514acf82 100644 --- a/lib/rib/rte_rib6.h +++ b/lib/rib/rte_rib6.h @@ -294,6 +294,17 @@ rte_rib6_get_nh(const struct rte_rib6_node *node, uint64_t *nh); int rte_rib6_set_nh(struct rte_rib6_node *node, uint64_t nh); + +/** + * Free an RIB object. + * + * @param rib + * RIB object handle created with rte_rib6_create(). + * If rib is NULL, no operation is performed. + */ +void +rte_rib6_free(struct rte_rib6 *rib); + /** * Create RIB * @@ -309,7 +320,8 @@ rte_rib6_set_nh(struct rte_rib6_node *node, uint64_t nh); */ struct rte_rib6 * rte_rib6_create(const char *name, int socket_id, - const struct rte_rib6_conf *conf); + const struct rte_rib6_conf *conf) + __rte_malloc __rte_dealloc(rte_rib6_free, 1); /** * Find an existing RIB object and return a pointer to it. @@ -323,16 +335,6 @@ rte_rib6_create(const char *name, int socket_id, struct rte_rib6 * rte_rib6_find_existing(const char *name); -/** - * Free an RIB object. - * - * @param rib - * RIB object handle created with rte_rib6_create(). - * If rib is NULL, no operation is performed. - */ -void -rte_rib6_free(struct rte_rib6 *rib); - #ifdef __cplusplus } #endif -- 2.45.2