From: Roman Kiryanov <rkir@google.com>
To: qemu-devel@nongnu.org
Cc: jansene@google.com, mett@google.com, jpcottin@google.com,
pbonzini@redhat.com, Roman Kiryanov <rkir@google.com>
Subject: [PATCH] iov: don't use void* in pointer arithmetic in headers
Date: Mon, 8 Jul 2024 11:17:09 -0700 [thread overview]
Message-ID: <20240708181709.27410-1-rkir@google.com> (raw)
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
next reply other threads:[~2024-07-08 18:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-08 18:17 Roman Kiryanov [this message]
2024-07-09 9:39 ` [PATCH] iov: don't use void* in pointer arithmetic in headers Peter Maydell
2024-07-10 21:47 ` Roman Kiryanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240708181709.27410-1-rkir@google.com \
--to=rkir@google.com \
--cc=jansene@google.com \
--cc=jpcottin@google.com \
--cc=mett@google.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).