* [PATCH] contrib/libvhost-user: Fix bad printf format specifiers
@ 2020-11-04 10:23 AlexChen
2020-11-16 2:14 ` Alex Chen
0 siblings, 1 reply; 4+ messages in thread
From: AlexChen @ 2020-11-04 10:23 UTC (permalink / raw)
To: mst, stefanha, marcandre.lureau; +Cc: QEMU Trivial, QEMU
We should use printf format specifier "%u" instead of "%d" for
argument of type "unsigned int".
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
index bfec8a881a..5c73ffdd6b 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -701,7 +701,7 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
return false;
}
- DPRINT("Adding region: %d\n", dev->nregions);
+ DPRINT("Adding region: %u\n", dev->nregions);
DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n",
msg_region->guest_phys_addr);
DPRINT(" memory_size: 0x%016"PRIx64"\n",
@@ -848,7 +848,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
dev->nregions = memory->nregions;
- DPRINT("Nregions: %d\n", memory->nregions);
+ DPRINT("Nregions: %u\n", memory->nregions);
for (i = 0; i < dev->nregions; i++) {
void *mmap_addr;
VhostUserMemoryRegion *msg_region = &memory->regions[i];
@@ -938,7 +938,7 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
return vu_set_mem_table_exec_postcopy(dev, vmsg);
}
- DPRINT("Nregions: %d\n", memory->nregions);
+ DPRINT("Nregions: %u\n", memory->nregions);
for (i = 0; i < dev->nregions; i++) {
void *mmap_addr;
VhostUserMemoryRegion *msg_region = &memory->regions[i];
@@ -1049,8 +1049,8 @@ vu_set_vring_num_exec(VuDev *dev, VhostUserMsg *vmsg)
unsigned int index = vmsg->payload.state.index;
unsigned int num = vmsg->payload.state.num;
- DPRINT("State.index: %d\n", index);
- DPRINT("State.num: %d\n", num);
+ DPRINT("State.index: %u\n", index);
+ DPRINT("State.num: %u\n", num);
dev->vq[index].vring.num = num;
return false;
@@ -1105,8 +1105,8 @@ vu_set_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
unsigned int index = vmsg->payload.state.index;
unsigned int num = vmsg->payload.state.num;
- DPRINT("State.index: %d\n", index);
- DPRINT("State.num: %d\n", num);
+ DPRINT("State.index: %u\n", index);
+ DPRINT("State.num: %u\n", num);
dev->vq[index].shadow_avail_idx = dev->vq[index].last_avail_idx = num;
return false;
@@ -1117,7 +1117,7 @@ vu_get_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
{
unsigned int index = vmsg->payload.state.index;
- DPRINT("State.index: %d\n", index);
+ DPRINT("State.index: %u\n", index);
vmsg->payload.state.num = dev->vq[index].last_avail_idx;
vmsg->size = sizeof(vmsg->payload.state);
@@ -1478,8 +1478,8 @@ vu_set_vring_enable_exec(VuDev *dev, VhostUserMsg *vmsg)
unsigned int index = vmsg->payload.state.index;
unsigned int enable = vmsg->payload.state.num;
- DPRINT("State.index: %d\n", index);
- DPRINT("State.enable: %d\n", enable);
+ DPRINT("State.index: %u\n", index);
+ DPRINT("State.enable: %u\n", enable);
if (index >= dev->max_queues) {
vu_panic(dev, "Invalid vring_enable index: %u", index);
@@ -1728,7 +1728,7 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg)
return false;
}
- DPRINT("Got kick message: handler:%p idx:%d\n",
+ DPRINT("Got kick message: handler:%p idx:%u\n",
dev->vq[index].handler, index);
if (!dev->vq[index].started) {
@@ -1772,7 +1772,7 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)
DPRINT("Request: %s (%d)\n", vu_request_to_string(vmsg->request),
vmsg->request);
DPRINT("Flags: 0x%x\n", vmsg->flags);
- DPRINT("Size: %d\n", vmsg->size);
+ DPRINT("Size: %u\n", vmsg->size);
if (vmsg->fd_num) {
int i;
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers
2020-11-04 10:23 [PATCH] contrib/libvhost-user: Fix bad printf format specifiers AlexChen
@ 2020-11-16 2:14 ` Alex Chen
2020-11-16 9:52 ` Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Alex Chen @ 2020-11-16 2:14 UTC (permalink / raw)
To: mst, stefanha, marcandre.lureau, Raphael Norwitz; +Cc: QEMU Trivial, QEMU
Kindly ping...
On 2020/11/4 18:23, AlexChen wrote:
> We should use printf format specifier "%u" instead of "%d" for
> argument of type "unsigned int".
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Alex Chen <alex.chen@huawei.com>
> ---
> contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index bfec8a881a..5c73ffdd6b 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -701,7 +701,7 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
> return false;
> }
>
> - DPRINT("Adding region: %d\n", dev->nregions);
> + DPRINT("Adding region: %u\n", dev->nregions);
> DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n",
> msg_region->guest_phys_addr);
> DPRINT(" memory_size: 0x%016"PRIx64"\n",
> @@ -848,7 +848,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
> VhostUserMemory m = vmsg->payload.memory, *memory = &m;
> dev->nregions = memory->nregions;
>
> - DPRINT("Nregions: %d\n", memory->nregions);
> + DPRINT("Nregions: %u\n", memory->nregions);
> for (i = 0; i < dev->nregions; i++) {
> void *mmap_addr;
> VhostUserMemoryRegion *msg_region = &memory->regions[i];
> @@ -938,7 +938,7 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
> return vu_set_mem_table_exec_postcopy(dev, vmsg);
> }
>
> - DPRINT("Nregions: %d\n", memory->nregions);
> + DPRINT("Nregions: %u\n", memory->nregions);
> for (i = 0; i < dev->nregions; i++) {
> void *mmap_addr;
> VhostUserMemoryRegion *msg_region = &memory->regions[i];
> @@ -1049,8 +1049,8 @@ vu_set_vring_num_exec(VuDev *dev, VhostUserMsg *vmsg)
> unsigned int index = vmsg->payload.state.index;
> unsigned int num = vmsg->payload.state.num;
>
> - DPRINT("State.index: %d\n", index);
> - DPRINT("State.num: %d\n", num);
> + DPRINT("State.index: %u\n", index);
> + DPRINT("State.num: %u\n", num);
> dev->vq[index].vring.num = num;
>
> return false;
> @@ -1105,8 +1105,8 @@ vu_set_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
> unsigned int index = vmsg->payload.state.index;
> unsigned int num = vmsg->payload.state.num;
>
> - DPRINT("State.index: %d\n", index);
> - DPRINT("State.num: %d\n", num);
> + DPRINT("State.index: %u\n", index);
> + DPRINT("State.num: %u\n", num);
> dev->vq[index].shadow_avail_idx = dev->vq[index].last_avail_idx = num;
>
> return false;
> @@ -1117,7 +1117,7 @@ vu_get_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
> {
> unsigned int index = vmsg->payload.state.index;
>
> - DPRINT("State.index: %d\n", index);
> + DPRINT("State.index: %u\n", index);
> vmsg->payload.state.num = dev->vq[index].last_avail_idx;
> vmsg->size = sizeof(vmsg->payload.state);
>
> @@ -1478,8 +1478,8 @@ vu_set_vring_enable_exec(VuDev *dev, VhostUserMsg *vmsg)
> unsigned int index = vmsg->payload.state.index;
> unsigned int enable = vmsg->payload.state.num;
>
> - DPRINT("State.index: %d\n", index);
> - DPRINT("State.enable: %d\n", enable);
> + DPRINT("State.index: %u\n", index);
> + DPRINT("State.enable: %u\n", enable);
>
> if (index >= dev->max_queues) {
> vu_panic(dev, "Invalid vring_enable index: %u", index);
> @@ -1728,7 +1728,7 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg)
> return false;
> }
>
> - DPRINT("Got kick message: handler:%p idx:%d\n",
> + DPRINT("Got kick message: handler:%p idx:%u\n",
> dev->vq[index].handler, index);
>
> if (!dev->vq[index].started) {
> @@ -1772,7 +1772,7 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)
> DPRINT("Request: %s (%d)\n", vu_request_to_string(vmsg->request),
> vmsg->request);
> DPRINT("Flags: 0x%x\n", vmsg->flags);
> - DPRINT("Size: %d\n", vmsg->size);
> + DPRINT("Size: %u\n", vmsg->size);
>
> if (vmsg->fd_num) {
> int i;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers
2020-11-16 2:14 ` Alex Chen
@ 2020-11-16 9:52 ` Michael S. Tsirkin
2020-11-16 11:13 ` Alex Chen
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2020-11-16 9:52 UTC (permalink / raw)
To: Alex Chen; +Cc: QEMU Trivial, marcandre.lureau, QEMU, stefanha, Raphael Norwitz
It's in the latest pull weren't you Cc'd?
On Mon, Nov 16, 2020 at 10:14:12AM +0800, Alex Chen wrote:
> Kindly ping...
>
> On 2020/11/4 18:23, AlexChen wrote:
> > We should use printf format specifier "%u" instead of "%d" for
> > argument of type "unsigned int".
> >
> > Reported-by: Euler Robot <euler.robot@huawei.com>
> > Signed-off-by: Alex Chen <alex.chen@huawei.com>
> > ---
> > contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++------------
> > 1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> > index bfec8a881a..5c73ffdd6b 100644
> > --- a/contrib/libvhost-user/libvhost-user.c
> > +++ b/contrib/libvhost-user/libvhost-user.c
> > @@ -701,7 +701,7 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
> > return false;
> > }
> >
> > - DPRINT("Adding region: %d\n", dev->nregions);
> > + DPRINT("Adding region: %u\n", dev->nregions);
> > DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n",
> > msg_region->guest_phys_addr);
> > DPRINT(" memory_size: 0x%016"PRIx64"\n",
> > @@ -848,7 +848,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
> > VhostUserMemory m = vmsg->payload.memory, *memory = &m;
> > dev->nregions = memory->nregions;
> >
> > - DPRINT("Nregions: %d\n", memory->nregions);
> > + DPRINT("Nregions: %u\n", memory->nregions);
> > for (i = 0; i < dev->nregions; i++) {
> > void *mmap_addr;
> > VhostUserMemoryRegion *msg_region = &memory->regions[i];
> > @@ -938,7 +938,7 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
> > return vu_set_mem_table_exec_postcopy(dev, vmsg);
> > }
> >
> > - DPRINT("Nregions: %d\n", memory->nregions);
> > + DPRINT("Nregions: %u\n", memory->nregions);
> > for (i = 0; i < dev->nregions; i++) {
> > void *mmap_addr;
> > VhostUserMemoryRegion *msg_region = &memory->regions[i];
> > @@ -1049,8 +1049,8 @@ vu_set_vring_num_exec(VuDev *dev, VhostUserMsg *vmsg)
> > unsigned int index = vmsg->payload.state.index;
> > unsigned int num = vmsg->payload.state.num;
> >
> > - DPRINT("State.index: %d\n", index);
> > - DPRINT("State.num: %d\n", num);
> > + DPRINT("State.index: %u\n", index);
> > + DPRINT("State.num: %u\n", num);
> > dev->vq[index].vring.num = num;
> >
> > return false;
> > @@ -1105,8 +1105,8 @@ vu_set_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
> > unsigned int index = vmsg->payload.state.index;
> > unsigned int num = vmsg->payload.state.num;
> >
> > - DPRINT("State.index: %d\n", index);
> > - DPRINT("State.num: %d\n", num);
> > + DPRINT("State.index: %u\n", index);
> > + DPRINT("State.num: %u\n", num);
> > dev->vq[index].shadow_avail_idx = dev->vq[index].last_avail_idx = num;
> >
> > return false;
> > @@ -1117,7 +1117,7 @@ vu_get_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg)
> > {
> > unsigned int index = vmsg->payload.state.index;
> >
> > - DPRINT("State.index: %d\n", index);
> > + DPRINT("State.index: %u\n", index);
> > vmsg->payload.state.num = dev->vq[index].last_avail_idx;
> > vmsg->size = sizeof(vmsg->payload.state);
> >
> > @@ -1478,8 +1478,8 @@ vu_set_vring_enable_exec(VuDev *dev, VhostUserMsg *vmsg)
> > unsigned int index = vmsg->payload.state.index;
> > unsigned int enable = vmsg->payload.state.num;
> >
> > - DPRINT("State.index: %d\n", index);
> > - DPRINT("State.enable: %d\n", enable);
> > + DPRINT("State.index: %u\n", index);
> > + DPRINT("State.enable: %u\n", enable);
> >
> > if (index >= dev->max_queues) {
> > vu_panic(dev, "Invalid vring_enable index: %u", index);
> > @@ -1728,7 +1728,7 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg)
> > return false;
> > }
> >
> > - DPRINT("Got kick message: handler:%p idx:%d\n",
> > + DPRINT("Got kick message: handler:%p idx:%u\n",
> > dev->vq[index].handler, index);
> >
> > if (!dev->vq[index].started) {
> > @@ -1772,7 +1772,7 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)
> > DPRINT("Request: %s (%d)\n", vu_request_to_string(vmsg->request),
> > vmsg->request);
> > DPRINT("Flags: 0x%x\n", vmsg->flags);
> > - DPRINT("Size: %d\n", vmsg->size);
> > + DPRINT("Size: %u\n", vmsg->size);
> >
> > if (vmsg->fd_num) {
> > int i;
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers
2020-11-16 9:52 ` Michael S. Tsirkin
@ 2020-11-16 11:13 ` Alex Chen
0 siblings, 0 replies; 4+ messages in thread
From: Alex Chen @ 2020-11-16 11:13 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: QEMU Trivial, marcandre.lureau, QEMU, stefanha, Raphael Norwitz
On 2020/11/16 17:52, Michael S. Tsirkin wrote:
> It's in the latest pull weren't you Cc'd?
>
This is my fault, I see this patch in the latest pull. thank you!!!
Thanks,
Alex
> On Mon, Nov 16, 2020 at 10:14:12AM +0800, Alex Chen wrote:
>> Kindly ping...
>>
>> On 2020/11/4 18:23, AlexChen wrote:
>>> We should use printf format specifier "%u" instead of "%d" for
>>> argument of type "unsigned int".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-16 11:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 10:23 [PATCH] contrib/libvhost-user: Fix bad printf format specifiers AlexChen
2020-11-16 2:14 ` Alex Chen
2020-11-16 9:52 ` Michael S. Tsirkin
2020-11-16 11:13 ` Alex Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.