qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iov: don't use void* in pointer arithmetic in headers
@ 2024-07-08 18:17 Roman Kiryanov
  2024-07-09  9:39 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Kiryanov @ 2024-07-08 18:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: jansene, mett, jpcottin, pbonzini, Roman Kiryanov

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



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

end of thread, other threads:[~2024-07-10 21:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-08 18:17 [PATCH] iov: don't use void* in pointer arithmetic in headers Roman Kiryanov
2024-07-09  9:39 ` Peter Maydell
2024-07-10 21:47   ` Roman Kiryanov

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).