qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] iov: don't use void* in pointer arithmetic in headers


From: Roman Kiryanov
Subject: [PATCH] iov: don't use void* in pointer arithmetic in headers
Date: Mon, 8 Jul 2024 11:17:09 -0700

void* pointer arithmetic is a GCC extentension
which could not be available in other build tools
(e.g. C++). This changes removes this assumption.

Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 include/qemu/iov.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/qemu/iov.h b/include/qemu/iov.h
index 63a1c01965..57afab370c 100644
--- a/include/qemu/iov.h
+++ b/include/qemu/iov.h
@@ -43,7 +43,7 @@ iov_from_buf(const struct iovec *iov, unsigned int iov_cnt,
 {
     if (__builtin_constant_p(bytes) && iov_cnt &&
         offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) {
-        memcpy(iov[0].iov_base + offset, buf, bytes);
+        memcpy((char *)iov[0].iov_base + offset, buf, bytes);
         return bytes;
     } else {
         return iov_from_buf_full(iov, iov_cnt, offset, buf, bytes);
@@ -56,7 +56,7 @@ iov_to_buf(const struct iovec *iov, const unsigned int 
iov_cnt,
 {
     if (__builtin_constant_p(bytes) && iov_cnt &&
         offset <= iov[0].iov_len && bytes <= iov[0].iov_len - offset) {
-        memcpy(buf, iov[0].iov_base + offset, bytes);
+        memcpy(buf, (const char *)iov[0].iov_base + offset, bytes);
         return bytes;
     } else {
         return iov_to_buf_full(iov, iov_cnt, offset, buf, bytes);
-- 
2.45.2.803.g4e1b14247a-goog




reply via email to

[Prev in Thread] Current Thread [Next in Thread]