[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 04/10] libvhost-user: Use unsigned int i for some for-loop ite
From: |
Marcel Holtmann |
Subject: |
[PATCH v3 04/10] libvhost-user: Use unsigned int i for some for-loop iterations |
Date: |
Wed, 21 Dec 2022 14:10:20 +0100 |
The sign-compare warning also hits some of the for-loops, but it easy
fixed by just making the iterator variable unsigned int.
CC libvhost-user.o
libvhost-user.c: In function ‘vu_gpa_to_va’:
libvhost-user.c:223:19: error: comparison of integer expressions of different
signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
223 | for (i = 0; i < dev->nregions; i++) {
| ^
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
subprojects/libvhost-user/libvhost-user.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/subprojects/libvhost-user/libvhost-user.c
b/subprojects/libvhost-user/libvhost-user.c
index bcdf32a24f60..211d31a4cc88 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -192,7 +192,7 @@ vu_panic(VuDev *dev, const char *msg, ...)
void *
vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr)
{
- int i;
+ unsigned int i;
if (*plen == 0) {
return NULL;
@@ -218,7 +218,7 @@ vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t
guest_addr)
static void *
qva_to_va(VuDev *dev, uint64_t qemu_addr)
{
- int i;
+ unsigned int i;
/* Find matching memory region. */
for (i = 0; i < dev->nregions; i++) {
@@ -621,7 +621,7 @@ map_ring(VuDev *dev, VuVirtq *vq)
static bool
generate_faults(VuDev *dev) {
- int i;
+ unsigned int i;
for (i = 0; i < dev->nregions; i++) {
VuDevRegion *dev_region = &dev->regions[i];
int ret;
@@ -829,7 +829,7 @@ static inline bool reg_equal(VuDevRegion *vudev_reg,
static bool
vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
VhostUserMemoryRegion m = vmsg->payload.memreg.region, *msg_region = &m;
- int i;
+ unsigned int i;
bool found = false;
if (vmsg->fd_num > 1) {
@@ -895,7 +895,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
static bool
vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
{
- int i;
+ unsigned int i;
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
dev->nregions = memory->nregions;
@@ -972,7 +972,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg
*vmsg)
static bool
vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
{
- int i;
+ unsigned int i;
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
for (i = 0; i < dev->nregions; i++) {
@@ -1980,7 +1980,7 @@ end:
void
vu_deinit(VuDev *dev)
{
- int i;
+ unsigned int i;
for (i = 0; i < dev->nregions; i++) {
VuDevRegion *r = &dev->regions[i];
--
2.38.1
- [PATCH v3 00/10] Compiler warning fixes for libvhost-user,libvduse, Marcel Holtmann, 2022/12/21
- [PATCH v3 01/10] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU, Marcel Holtmann, 2022/12/21
- [PATCH v3 05/10] libvhost-user: Declare uffdio_register early to make it C90 compliant, Marcel Holtmann, 2022/12/21
- [PATCH v3 04/10] libvhost-user: Use unsigned int i for some for-loop iterations,
Marcel Holtmann <=
- [PATCH v3 07/10] libvhost-user: Switch to unsigned int for inuse field in struct VuVirtq, Marcel Holtmann, 2022/12/21
- [PATCH v3 08/10] libvduse: Provide _GNU_SOURCE when compiling outside of QEMU, Marcel Holtmann, 2022/12/21
- [PATCH v3 03/10] libvhost-user: Cast rc variable to avoid compiler warning, Marcel Holtmann, 2022/12/21
- [PATCH v3 02/10] libvhost-user: Replace typeof with __typeof__, Marcel Holtmann, 2022/12/21
- [PATCH v3 06/10] libvhost-user: Change dev->postcopy_ufd assignment to make it C90 compliant, Marcel Holtmann, 2022/12/21
- [PATCH v3 10/10] libvduse: Fix assignment in vring_set_avail_event, Marcel Holtmann, 2022/12/21