From patchwork Fri Jun 21 02:40:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhichao Zeng X-Patchwork-Id: 141463 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E19A3454B2; Fri, 21 Jun 2024 04:30:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBF8840265; Fri, 21 Jun 2024 04:30:00 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mails.dpdk.org (Postfix) with ESMTP id 0685B4025E; Fri, 21 Jun 2024 04:29:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1718936999; x=1750472999; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=De7YW+zHV3SdNNp+qODxrp2b6gnrXM1KA5B2adzSa1w=; b=QPs8o13zghMiNkp+IgUMn1kikYAJdJ+JCDAHJ2ncRZ9QNNneTn51EzmS nF9kVIQeQgDRTUhiyUQOivfIUc8yY0ssXSapbyv7y/NV25BCBqMNxyMye 4zbyB1G80QR+dRvJe9yWEAUnVaGYPZUWWcZCup8Oq9GJg/wzyV1tTtltU zEh+Xb00/CB23aavo6iOzubhhkRNMlTCMBcgC2bH9zflvu45+VkpWFQDO f+GHjS0hzE9uk+xXRM49HPY8MQ03vjfgFe2BHuDFYECwc3bc7INXx1pYR rfZjLfTGFnq1QwQWhbZDYyw7dew4MFmV1Tq7a8oaxtf/qlfIBGOI13zi3 w==; X-CSE-ConnectionGUID: 9jC99HXHTza+VmBfTgNZLQ== X-CSE-MsgGUID: DMyah7s2ThK32EBsPQ8jGQ== X-IronPort-AV: E=McAfee;i="6700,10204,11109"; a="15786621" X-IronPort-AV: E=Sophos;i="6.08,253,1712646000"; d="scan'208";a="15786621" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2024 19:29:58 -0700 X-CSE-ConnectionGUID: LXbTPMunQyy1AjI+3QRKOA== X-CSE-MsgGUID: K10e62mMTtObuTczKjmXkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,253,1712646000"; d="scan'208";a="65692407" Received: from unknown (HELO zhichao-dpdk..) ([10.239.252.103]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2024 19:29:55 -0700 From: Zhichao Zeng To: dev@dpdk.org Cc: stable@dpdk.org, Zhichao Zeng , Bruce Richardson , Keith Wiles , Ciara Power Subject: [PATCH] telemetry: fix potential connection issue Date: Fri, 21 Jun 2024 10:40:37 +0800 Message-Id: <20240621024037.3412372-1-zhichaox.zeng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 For calling memcpy when the source and destination addresses are the same, there is a small probability that there will be a copy error issue in some environments, resulting in a failure to connect. This patch uses memmove instead of memcpy to avoid this issue. Fixes: b80fe1805eee ("telemetry: introduce backward compatibility") Cc: stable@dpdk.org Signed-off-by: Zhichao Zeng Tested-by: Song Jiale --- lib/telemetry/telemetry_legacy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/telemetry/telemetry_legacy.c b/lib/telemetry/telemetry_legacy.c index 4c1d1c353a..578230732c 100644 --- a/lib/telemetry/telemetry_legacy.c +++ b/lib/telemetry/telemetry_legacy.c @@ -94,7 +94,7 @@ register_client(const char *cmd __rte_unused, const char *params, } #ifndef RTE_EXEC_ENV_WINDOWS strlcpy(data, strchr(params, ':'), sizeof(data)); - memcpy(data, &data[strlen(":\"")], strlen(data)); + memmove(data, &data[strlen(":\"")], strlen(data)); if (!strchr(data, '\"')) { fprintf(stderr, "Invalid client data\n"); return -1;