[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PATCH v3 09/25] vhost-user: Express sizeof with size_t
From: |
Philippe Mathieu-Daudé |
Subject: |
[qemu-s390x] [PATCH v3 09/25] vhost-user: Express sizeof with size_t |
Date: |
Wed, 20 Feb 2019 02:02:16 +0100 |
VHOST_USER_HDR_SIZE uses offsetof(), thus is an expression of type
size_t. Update the format string accordingly.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/virtio/vhost-user.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 564a31d12c..2eb7143d3d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -215,11 +215,12 @@ static int vhost_user_read(struct vhost_dev *dev,
VhostUserMsg *msg)
struct vhost_user *u = dev->opaque;
CharBackend *chr = u->user->chr;
uint8_t *p = (uint8_t *) msg;
- int r, size = VHOST_USER_HDR_SIZE;
+ int r;
+ size_t size = VHOST_USER_HDR_SIZE;
r = qemu_chr_fe_read_all(chr, p, size);
if (r != size) {
- error_report("Failed to read msg header. Read %d instead of %d."
+ error_report("Failed to read msg header. Read %d instead of %zu."
" Original request %d.", r, size, msg->hdr.request);
goto fail;
}
@@ -235,7 +236,7 @@ static int vhost_user_read(struct vhost_dev *dev,
VhostUserMsg *msg)
/* validate message size is sane */
if (msg->hdr.size > VHOST_USER_PAYLOAD_SIZE) {
error_report("Failed to read msg header."
- " Size %d exceeds the maximum %zu.", msg->hdr.size,
+ " Size %u exceeds the maximum %zu.", msg->hdr.size,
VHOST_USER_PAYLOAD_SIZE);
goto fail;
}
@@ -246,7 +247,7 @@ static int vhost_user_read(struct vhost_dev *dev,
VhostUserMsg *msg)
r = qemu_chr_fe_read_all(chr, p, size);
if (r != size) {
error_report("Failed to read msg payload."
- " Read %d instead of %d.", r, msg->hdr.size);
+ " Read %d instead of %u.", r, msg->hdr.size);
goto fail;
}
}
@@ -300,7 +301,8 @@ static int vhost_user_write(struct vhost_dev *dev,
VhostUserMsg *msg,
{
struct vhost_user *u = dev->opaque;
CharBackend *chr = u->user->chr;
- int ret, size = VHOST_USER_HDR_SIZE + msg->hdr.size;
+ int ret;
+ size_t size = VHOST_USER_HDR_SIZE + msg->hdr.size;
/*
* For non-vring specific requests, like VHOST_USER_SET_MEM_TABLE,
@@ -320,7 +322,7 @@ static int vhost_user_write(struct vhost_dev *dev,
VhostUserMsg *msg,
ret = qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size);
if (ret != size) {
error_report("Failed to write msg."
- " Wrote %d instead of %d.", ret, size);
+ " Wrote %d instead of %zu.", ret, size);
return -1;
}
--
2.20.1
- [qemu-s390x] [PATCH v3 00/25] chardev: Convert qemu_chr_write() to take a size_t argument, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 15/25] spapr-vty: Let vty_putchars() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 20/25] s390x/sclp: Use a const variable to improve readability, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 12/25] xen: Let buffer_append() return the size consumed, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 09/25] vhost-user: Express sizeof with size_t,
Philippe Mathieu-Daudé <=
- [qemu-s390x] [PATCH v3 07/25] gdbstub: Let put_buffer() use size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 06/25] gdbstub: Use size_t to hold GDBState::last_packet_len, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [RFC PATCH v3 13/25] xen: Let buffer_append() return a size_t, Philippe Mathieu-Daudé, 2019/02/19
- [qemu-s390x] [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argument, Philippe Mathieu-Daudé, 2019/02/19