From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by dpdk.org (Postfix) with ESMTP id 6F09D23D for ; Mon, 30 Jul 2018 18:21:55 +0200 (CEST) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=lap.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fkAsc-00009D-NK; Mon, 30 Jul 2018 16:18:42 +0000 From: Christian Ehrhardt To: Remy Horton Cc: Ferruh Yigit , dpdk stable Date: Mon, 30 Jul 2018 18:13:33 +0200 Message-Id: <20180730161342.16566-168-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180730161342.16566-1-christian.ehrhardt@canonical.com> References: <20180730161342.16566-1-christian.ehrhardt@canonical.com> Subject: [dpdk-stable] patch 'bitrate: add sanity check on parameters' has been queued to stable release 18.05.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2018 16:21:55 -0000 Hi, FYI, your patch has been queued to stable release 18.05.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/01/18. So please shout if anyone has objections. Thanks. Christian Ehrhardt --- >>From 4312b6d5f4914302678100a98ba40f413dcf44da Mon Sep 17 00:00:00 2001 From: Remy Horton Date: Thu, 12 Jul 2018 11:49:48 +0100 Subject: [PATCH] bitrate: add sanity check on parameters [ upstream commit 90b0e5aaf4e3a56a4dac57aceb425930450cec85 ] If rte_stats_bitrate_reg() or rte_stats_bitrate_calc() are passed NULL as the parameter for the stats structure, the result is a crash. Fixed by adding a sanity check that makes sure the passed-in pointer is not NULL. Fixes: 2ad7ba9a6567 ("bitrate: add bitrate statistics library") Signed-off-by: Remy Horton Acked-by: Ferruh Yigit --- lib/librte_bitratestats/rte_bitrate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index 964e3c39f..c4b28f624 100644 --- a/lib/librte_bitratestats/rte_bitrate.c +++ b/lib/librte_bitratestats/rte_bitrate.c @@ -47,6 +47,9 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data) }; int return_value; + if (bitrate_data == NULL) + return -EINVAL; + return_value = rte_metrics_reg_names(&names[0], ARRAY_SIZE(names)); if (return_value >= 0) bitrate_data->id_stats_set = return_value; @@ -65,6 +68,9 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, const int64_t alpha_percent = 20; uint64_t values[6]; + if (bitrate_data == NULL) + return -EINVAL; + ret_code = rte_eth_stats_get(port_id, ð_stats); if (ret_code != 0) return ret_code; -- 2.17.1