DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] telemetry: fix potential connection issue
@ 2024-06-21  2:40 Zhichao Zeng
  2024-06-26  2:13 ` Jiale, SongX
  0 siblings, 1 reply; 3+ messages in thread
From: Zhichao Zeng @ 2024-06-21  2:40 UTC (permalink / raw)
  To: dev; +Cc: stable, Zhichao Zeng, Bruce Richardson, Keith Wiles, Ciara Power

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 <zhichaox.zeng@intel.com>
---
 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;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] telemetry: fix potential connection issue
  2024-06-21  2:40 [PATCH] telemetry: fix potential connection issue Zhichao Zeng
@ 2024-06-26  2:13 ` Jiale, SongX
  2024-07-07 13:11   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Jiale, SongX @ 2024-06-26  2:13 UTC (permalink / raw)
  To: Zeng, ZhichaoX, dev; +Cc: stable, Zeng, ZhichaoX

> -----Original Message-----
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
> Sent: Friday, June 21, 2024 10:41 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zeng, ZhichaoX <zhichaox.zeng@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>; Wiles, Keith
> <keith.wiles@intel.com>; Ciara Power <ciara.power@intel.com>
> Subject: [PATCH] telemetry: fix potential connection issue
> 
> 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 <zhichaox.zeng@intel.com>
> ---
Tested-by: Song Jiale <songx.jiale@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] telemetry: fix potential connection issue
  2024-06-26  2:13 ` Jiale, SongX
@ 2024-07-07 13:11   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2024-07-07 13:11 UTC (permalink / raw)
  To: Zeng, ZhichaoX; +Cc: dev, stable, Jiale, SongX

26/06/2024 04:13, Jiale, SongX:
> From: Zhichao Zeng <zhichaox.zeng@intel.com>
> > 
> > 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 <zhichaox.zeng@intel.com>
> > ---
> Tested-by: Song Jiale <songx.jiale@intel.com>

It would be cleaner to do a proper parsing before doing any copy (strlcpy, memcpy/memmove).

dirty code dirty fixed for now
Applied




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-07 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-21  2:40 [PATCH] telemetry: fix potential connection issue Zhichao Zeng
2024-06-26  2:13 ` Jiale, SongX
2024-07-07 13:11   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).