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 56E8041E65 for ; Fri, 10 Mar 2023 19:22:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4ADF9410D0; Fri, 10 Mar 2023 19:22:27 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id F0C7540685; Fri, 10 Mar 2023 19:22:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678472544; x=1710008544; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=QnvcUwhIkOpjubCzcIcxge4xm6qPOg42ChkJbXf1Dxw=; b=YjKslTxta6AC4+T49L/wNAExaF8/ECkRQwAorwU7pKvV004DwwwPtCpt UQE/eOh2fM7BA12KiQU92pPI2NTxrLmWFRvmBMWe1nlHd5yhh+4dltR97 DPJorOCR9LzZwOiUm/hCTQxspuWS+PiPZxWqy4Z4YcWS97/o/MSADpiUY aPU7jHfLiv84dg2mQtAcbzsQdJUudT4+oLWoizRYKswiCuT/NfNPa1wZ3 dBLfBN37U+1ivMgZ6uIA2Jrr1zByHr607U9dc4ubZgvkeC3o6GWikpyuF I7mCme7lPYm0wZOWT5xua63xQbR3mlyPWl4vXU2ezgzfVOpKJgOujmBeU w==; X-IronPort-AV: E=McAfee;i="6500,9779,10645"; a="399395824" X-IronPort-AV: E=Sophos;i="5.98,250,1673942400"; d="scan'208";a="399395824" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2023 10:19:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10645"; a="788120662" X-IronPort-AV: E=Sophos;i="5.98,250,1673942400"; d="scan'208";a="788120662" Received: from silpixa00401385.ir.intel.com ([10.237.214.22]) by fmsmga002.fm.intel.com with ESMTP; 10 Mar 2023 10:19:08 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Ciara Power , Declan Doherty , Radu Nicolau Subject: [PATCH] telemetry: fix autotest failures on Alpine Date: Fri, 10 Mar 2023 18:18:36 +0000 Message-Id: <20230310181836.162336-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.37.2 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 On Alpine linux, the telemetry_data_autotest was failing for the test where we had dictionaries embedded in other dictionaries up to three levels deep. Indications are that this issue is due to excess data being stored on the stack, so replace stack-allocated buffer data with dynamically allocated data in the case where we are doing recursive processing of telemetry data structures into json. Bugzilla ID: 1177 Fixes: c933bb5177ca ("telemetry: support array values in data object") Fixes: d2671e642a8e ("telemetry: support dict of dicts") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- lib/telemetry/telemetry.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 7bceadcee7..34d371ab8a 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -208,7 +208,9 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) break; case RTE_TEL_CONTAINER: { - char temp[buf_len]; + char *temp = malloc(buf_len); + if (temp == NULL) + break; const struct container *cont = &v->value.container; if (container_to_json(cont->data, @@ -219,6 +221,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len) v->name, temp); if (!cont->keep) rte_tel_data_free(cont->data); + free(temp); break; } } @@ -275,7 +278,9 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) break; case RTE_TEL_CONTAINER: { - char temp[buf_len]; + char *temp = malloc(buf_len); + if (temp == NULL) + break; const struct container *cont = &v->value.container; if (container_to_json(cont->data, @@ -286,6 +291,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) v->name, temp); if (!cont->keep) rte_tel_data_free(cont->data); + free(temp); } } } @@ -311,7 +317,9 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) buf_len, used, d->data.array[i].uval); else if (d->type == TEL_ARRAY_CONTAINER) { - char temp[buf_len]; + char *temp = malloc(buf_len); + if (temp == NULL) + break; const struct container *rec_data = &d->data.array[i].container; if (container_to_json(rec_data->data, @@ -321,6 +329,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) buf_len, used, temp); if (!rec_data->keep) rte_tel_data_free(rec_data->data); + free(temp); } break; } -- 2.37.2