From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD7B3A0561; Thu, 27 Feb 2020 18:17:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 07B872C4F; Thu, 27 Feb 2020 18:17:40 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 3D7731C01; Thu, 27 Feb 2020 18:17:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2020 09:17:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,492,1574150400"; d="scan'208";a="385227292" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.222.53]) by orsmga004.jf.intel.com with ESMTP; 27 Feb 2020 09:17:35 -0800 From: Ciara Power To: kevin.laatz@intel.com Cc: dev@dpdk.org, Ciara Power , reshma.pattan@intel.com, stable@dpdk.org Date: Thu, 27 Feb 2020 17:04:56 +0000 Message-Id: <20200227170456.29164-1-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] telemetry: fix struct reset after value assignment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The ep struct is used to track what type of stats are required by the client. For PORT_STATS type, it contains the lists of port and metric ids to query, and the number of ids in each list. The ep struct has values set (num of port and metric ids) when a request for port stats values by name is received. However, after this value assignment, the struct is reset to all 0 values, meaning the number of port and metric ids required now both show as 0, and the client will not receive the requested data in response. To fix this issue, the memset call is now moved above the ep struct value assignment. Fixes: 4080e46c8078 ("telemetry: support global metrics") Cc: reshma.pattan@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power --- lib/librte_telemetry/rte_telemetry_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_telemetry/rte_telemetry_parser.c b/lib/librte_telemetry/rte_telemetry_parser.c index 960132397..e8c269e85 100644 --- a/lib/librte_telemetry/rte_telemetry_parser.c +++ b/lib/librte_telemetry/rte_telemetry_parser.c @@ -456,9 +456,9 @@ rte_telemetry_command_ports_stats_values_by_name(struct telemetry_impl size_t index; json_t *value; + memset(&ep, 0, sizeof(ep)); ep.pp.num_port_ids = json_array_size(port_ids_json); ep.pp.num_metric_ids = num_stat_names; - memset(&ep, 0, sizeof(ep)); if (telemetry == NULL) { TELEMETRY_LOG_ERR("Invalid telemetry argument"); return -1; -- 2.17.1