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 69D2C46104; Sat, 25 Jan 2025 03:13:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C7F340657; Sat, 25 Jan 2025 03:13:33 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 5083F402CE for ; Sat, 25 Jan 2025 03:13:22 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2162c0f6a39so71521095ad.0 for ; Fri, 24 Jan 2025 18:13:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771201; x=1738376001; 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=eUkfFxUp0mnwBzVkcPamGMI/9Vqc3APc0qqtuVbVrvA=; b=TIZexKLt8sTOOyCo6oIIWI5jDST7WNAmBRqLnYTrtHOX/BJ694XB/hE25yDQEId7Gs 4R5nFg+hzKjPuqIYmQfNA6IfeQBOwINFBDlKqys7FqFKeT0hNMFzqyCNKHepweSwObd2 8QhfOuk8M+z+mAy+KH+rbw1aZatUa1+y5mlg2uZG2UwbBNNH/cfkMrCkWC15Ce79qsFi Strzj2v3C9G0IjBFbHU60upCrfesm331Zn+BI9UC7pqCZV57TXdjx/Rl6mf480sS1TXX xWBiM3iH93hMmPSJvVPF+le9+iDl/fCKZFKZkIxw7q2309kHUeZIDM/mfjeFB+XpafjW gqhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771201; x=1738376001; 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=eUkfFxUp0mnwBzVkcPamGMI/9Vqc3APc0qqtuVbVrvA=; b=DgC/cKx6kYimPjuTjo4WyWn2DYldaxcoJ5QM5Z66/MfC1HFSKxiKuHxo10tCkFquOu lkraMrlx2e31e+iUSfDjL4sitYNSHlMAbTNDky6aZO5K3cgyO7+nO4X+7oAAfexB+vui seihZ7Vqx1EwIRt+0RD83lGrqFfnz8VEKoIW4d0XjlviEw0ds55tZqC0dlKYIQZn9MP7 TuhBOaqOHBO0zR7RNb5LQUzdYR1EY7METrUqvLm+h+Qu3LHIJxjV1ocNbSbG7AF9l4w8 0mzvtpifyYHIK5w4066gfdSi4/0RRtppReew4488MthaY0S3MrYu5b39fl8M9RaHpC/f rbbg== X-Gm-Message-State: AOJu0Yw/ejuZ/Xp7IIp4OJ4izLU20kHxmqPvqZx2k8wGRexRylEyyUZZ 1rXKlv/ObW8bsLoH8iV56ku19U81CGHOnbW7XkU594exblTX88oRgITdYtnAaaYN0+jMtttMQ8L 6 X-Gm-Gg: ASbGncsEl5JaBFQFpVlmSB0rdBYfJyR/yfWphEwqqsPJoafcOp4hlTQQPQgeY+yyOq3 alwMin1D3x5skQvqBRoMslQmlL7jpWzkgMkPlntlNJFQVtDqXA64Ys6ZmUaIUlBSd3Bh71hFG75 /3IAXMN8d0ICmiPlQePPn27EDATu+o+R7cL6D6/jZGAgZXFf+Yc2XLsRD7mzaFQNC72kUaO3AJk rhbXgHgZu+SD646HeKo/Ns9HrNurluQGUJkaw92wiq4kS7HQuVTJNbe+UCla8vVlHksAzPqjbPN WoHv1JZKcyUeNzF1jQdGRz4PhQ1HN5A945tDmZ0p6GzK9AFBu7H8S/KhWA== X-Google-Smtp-Source: AGHT+IHCbMhiLvKNM6FavegNX4fsa3nnTfpRFit768+ec+2RG58W48BvECd5z0l6cMZ+4BbOpbf/Gw== X-Received: by 2002:a05:6a00:7289:b0:729:425:fde4 with SMTP id d2e1a72fcca58-72f8b3f2249mr7553398b3a.11.1737771201660; Fri, 24 Jan 2025 18:13:21 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac48e84e199sm2345256a12.11.2025.01.24.18.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:21 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v5 07/16] bitratestats: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:20 -0800 Message-ID: <20250125021305.76485-8-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250125021305.76485-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.org> <20250125021305.76485-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 Use function attributes to catch cases where bitratestats is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/bitratestats/rte_bitrate.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/bitratestats/rte_bitrate.h b/lib/bitratestats/rte_bitrate.h index 979a712837..75883f8779 100644 --- a/lib/bitratestats/rte_bitrate.h +++ b/lib/bitratestats/rte_bitrate.h @@ -7,6 +7,8 @@ #include +#include + #ifdef __cplusplus extern "C" { #endif @@ -17,16 +19,6 @@ extern "C" { */ struct rte_stats_bitrates; - -/** - * Allocate a bitrate statistics structure - * - * @return - * - Pointer to structure on success - * - NULL on error (zmalloc failure) - */ -struct rte_stats_bitrates *rte_stats_bitrate_create(void); - /** * Free bitrate statistics structure * @@ -36,6 +28,16 @@ struct rte_stats_bitrates *rte_stats_bitrate_create(void); */ void rte_stats_bitrate_free(struct rte_stats_bitrates *bitrate_data); +/** + * Allocate a bitrate statistics structure + * + * @return + * - Pointer to structure on success + * - NULL on error (zmalloc failure) + */ +struct rte_stats_bitrates *rte_stats_bitrate_create(void) + __rte_malloc __rte_dealloc(rte_stats_bitrate_free, 1); + /** * Register bitrate statistics with the metric library. * -- 2.45.2