From 7e6cdc754ae82706435e8bdd8e98d0f4f6cf9881 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Wed, 28 May 2025 15:57:27 +0200 Subject: send_reply_uring: Avoid memcpy if src and dest are identical The application might have just written directly into the payload to no need to copy it and in fact, using memcpy would be undefined behavior. Signed-off-by: Bernd Schubert --- lib/fuse_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fuse_uring.c b/lib/fuse_uring.c index ee68fab..4c6f0a4 100644 --- a/lib/fuse_uring.c +++ b/lib/fuse_uring.c @@ -233,7 +233,8 @@ int send_reply_uring(fuse_req_t req, int error, const void *arg, size_t argsize) argsize, max_payload_sz); error = -EINVAL; } else if (argsize) { - memcpy(ring_ent->op_payload, arg, argsize); + if (arg != ring_ent->op_payload) + memcpy(ring_ent->op_payload, arg, argsize); } ent_in_out->payload_sz = argsize; -- cgit v1.2.3