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 A531746B72 for ; Mon, 14 Jul 2025 17:13:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F164400D5; Mon, 14 Jul 2025 17:13:05 +0200 (CEST) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mails.dpdk.org (Postfix) with ESMTP id 35460402EE for ; Mon, 14 Jul 2025 17:13:04 +0200 (CEST) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-45600581226so23619755e9.1 for ; Mon, 14 Jul 2025 08:13:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752505984; x=1753110784; 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=+2SKWheIWBR2JKgzJj3SeOUlwUtK0LScWd88dZPfyJ8=; b=PutWncdv7f1RxQi1AgutyCLWQ3C1VWAZ2s08H/dOdpEExQV/RafEsn5kHf2mEjdwMy IVFBn/NjGY4xDEoimt/lCN/qzmrDU85RYlIR3EHXwA8wT+0FlkUY0HINQaQzXXvM0JaD i/MAO6Sxsk39dtxz43ky44Mn5BmUxfr/7UynHZNtpfP4Irr4sbMjpNIvI4r0mpasbozd ovE9c0nZ5CG8ZWzhDo+/eH7HYEz9GbGTHa6QAfSN9SsQaZmMhislNNv+kw2tqg0mxEW7 WZ+K0Fcjh5HSZeNcambJhtDkS1h278sZ2ZCS7LKy/mpS8oJGXPO3kIj4xyJZSKttUbxq FPKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752505984; x=1753110784; 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=+2SKWheIWBR2JKgzJj3SeOUlwUtK0LScWd88dZPfyJ8=; b=Tx+9pQtVVdEWG9MFfhIaG6ZRNKUgDDbZPr+HqSMeL6ybGh3Pl5iDHLscLhHb/116AV 1ANv7sW18FQWIqWneoZCJHMrApryeh8VmxpsuzpS/iLmb4fUnNS5ui3kq8cHOhgM3v+n xpDEfULHJ2sxty3HFsUUaGC4MNOph7Qe/E7FcvzFn5Ey5mJuHewlo4TSH3PcXA1rp4Bl G5kRFbrTFJh2diJ70Vq4XVsEv3EuvZprbl/UGACH7Q7AFRT1R0Ou4zET5xUnbELjSrxL vXP0mLo4OIOqWygnZBeM8HO5vcBc3Rx3gWvwAr4vsFNUHSasp+7Ty+mhmiJ1SoblLjW1 WGTA== X-Gm-Message-State: AOJu0YypK1zUrCaEKk1CZWqUJIMMxCGOqiajFVG1Y5fvkS7vesEdDcoQ yQHBwLf5OMjZD4DkDv+2gkKcx7R8wCxEQwtTwucQRKVpG4I42hFPCAI1GbYT86wC X-Gm-Gg: ASbGncsBAemIwvdt6mWvuKzAjbI+npeqfBfWMe+yqk8Hdihf/U/vxW9DfLDDkRYEUjN xD9couqRvVkB98xJbCBilu+M3rlaK1sFuCCTkt86ydtx7Hi4hs9nnbkA4LDVes6es+G4Yewd7Vn VdfUR5mDeo9eTswpL/1Z2DFqng+kugmR9RkWMLkBXm2hJsahYRpMshOC13FqWTyEcrdwtePIlnu YyC4BPHCGTEc/pTepuKXMLNyPxT3vzjujx03l2pqx7OiBCBCM+u7D4mLdRDJVTQwzS36GtcyJ7r x+NpLUc6xJrjtVf8m7oX2kZoahywEMcYJI/v7z/rYLDN6Tt16NU9e5pCIvMrpt1MLmyxIGna1Wf HzbnlTJGH+luso9B6EVzbxfbMN849 X-Google-Smtp-Source: AGHT+IFs8f6LTKEs39GOzou8P2HgQLz7oVWfLHKHcchucRwcOaD9goyEAxuV/jdnAIDYBVHo8NbVqw== X-Received: by 2002:a05:600c:4f8f:b0:454:ccd6:327 with SMTP id 5b1f17b1804b1-454ec1338famr119280135e9.1.1752505983691; Mon, 14 Jul 2025 08:13:03 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:a923:75e5:f97f:ef33]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4560f22cd29sm65047195e9.34.2025.07.14.08.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 08:13:03 -0700 (PDT) From: luca.boccassi@gmail.com To: Bing Zhao Cc: dpdk stable Subject: patch 'examples/ntb: check more heap allocations' has been queued to stable release 22.11.9 Date: Mon, 14 Jul 2025 16:11:15 +0100 Message-ID: <20250714151121.219866-20-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250714151121.219866-1-luca.boccassi@gmail.com> References: <20250630122556.1133654-23-luca.boccassi@gmail.com> <20250714151121.219866-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/16/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/97e4c9786fde71a345883a17e80301a7923b4e1d Thanks. Luca Boccassi --- >From 97e4c9786fde71a345883a17e80301a7923b4e1d Mon Sep 17 00:00:00 2001 From: Bing Zhao Date: Wed, 21 May 2025 20:23:33 +0300 Subject: [PATCH] examples/ntb: check more heap allocations [ upstream commit 0c1a5ff96bfca1ac513b64f081a20f4992c6fcc0 ] In some rare case, the libc memory heap allocation may fail and return NULL pointer. Before accessing the memory via the pointer, the NULL pointer check should be done to ensure the code locates in the safe side and no crash. Some newer GCC version will check this by default and report warning on this. Adding the NULL pointer check will help to get rid of such warning. Fixes: 5194299d6ef5 ("examples/ntb: support more functions") Signed-off-by: Bing Zhao --- examples/ntb/ntb_fwd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index 5082e66c7b..1c2f013402 100644 --- a/examples/ntb/ntb_fwd.c +++ b/examples/ntb/ntb_fwd.c @@ -870,6 +870,10 @@ ntb_stats_clear(void) return; } ids = malloc(sizeof(uint32_t) * nb_ids); + if (ids == NULL) { + printf("Cannot allocate memory for statistics IDs\n"); + return; + } for (i = 0; i < nb_ids; i++) ids[i] = i; rte_rawdev_xstats_reset(dev_id, ids, nb_ids); @@ -939,9 +943,20 @@ ntb_stats_display(void) return; } ids = malloc(sizeof(uint32_t) * nb_ids); + if (ids == NULL) { + printf("Cannot allocate memory for statistics IDs\n"); + free(xstats_names); + return; + } for (i = 0; i < nb_ids; i++) ids[i] = i; values = malloc(sizeof(uint64_t) * nb_ids); + if (values == NULL) { + printf("Cannot allocate memory to save fetching values\n"); + free(xstats_names); + free(ids); + return; + } if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) { printf("Error: Unable to get xstats\n"); free(xstats_names); -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-07-14 16:09:41.442058816 +0100 +++ 0020-examples-ntb-check-more-heap-allocations.patch 2025-07-14 16:09:40.724449252 +0100 @@ -1 +1 @@ -From 0c1a5ff96bfca1ac513b64f081a20f4992c6fcc0 Mon Sep 17 00:00:00 2001 +From 97e4c9786fde71a345883a17e80301a7923b4e1d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0c1a5ff96bfca1ac513b64f081a20f4992c6fcc0 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 37d60208e3..33f3c1ef17 100644 +index 5082e66c7b..1c2f013402 100644 @@ -27 +28 @@ -@@ -774,6 +774,10 @@ ntb_stats_clear(void) +@@ -870,6 +870,10 @@ ntb_stats_clear(void) @@ -38 +39 @@ -@@ -843,9 +847,20 @@ ntb_stats_display(void) +@@ -939,9 +943,20 @@ ntb_stats_display(void)