From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B9FC6379F for ; Mon, 16 Nov 2020 02:15:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF9FF2227F for ; Mon, 16 Nov 2020 02:15:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF9FF2227F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:60020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1keU3I-0002R7-No for qemu-devel@archiver.kernel.org; Sun, 15 Nov 2020 21:15:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keU2W-0001qT-2b; Sun, 15 Nov 2020 21:14:44 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1keU2S-0007fv-Vn; Sun, 15 Nov 2020 21:14:43 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CZCLV0xHfz6tw8; Mon, 16 Nov 2020 10:14:10 +0800 (CST) Received: from [10.174.187.138] (10.174.187.138) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Mon, 16 Nov 2020 10:14:12 +0800 Message-ID: <5FB1E074.50205@huawei.com> Date: Mon, 16 Nov 2020 10:14:12 +0800 From: Alex Chen User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: , , , Raphael Norwitz Subject: Re: [PATCH] contrib/libvhost-user: Fix bad printf format specifiers References: <5FA28106.6000901@huawei.com> In-Reply-To: <5FA28106.6000901@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.187.138] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.35; envelope-from=alex.chen@huawei.com; helo=szxga07-in.huawei.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/15 21:14:23 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , QEMU Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 > Signed-off-by: Alex Chen > --- > 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; >