mirror of https://github.com/xemu-project/xemu.git
libvhost-user: Use unsigned int i for some for-loop iterations
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> Message-Id: <decb925e1a6fb9538738d2570bda2804f888fa15.1671741278.git.marcel@holtmann.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
18fa7f1e95
commit
92bf246130
|
@ -192,7 +192,7 @@ vu_panic(VuDev *dev, const char *msg, ...)
|
||||||
void *
|
void *
|
||||||
vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr)
|
vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (*plen == 0) {
|
if (*plen == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -218,7 +218,7 @@ vu_gpa_to_va(VuDev *dev, uint64_t *plen, uint64_t guest_addr)
|
||||||
static void *
|
static void *
|
||||||
qva_to_va(VuDev *dev, uint64_t qemu_addr)
|
qva_to_va(VuDev *dev, uint64_t qemu_addr)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Find matching memory region. */
|
/* Find matching memory region. */
|
||||||
for (i = 0; i < dev->nregions; i++) {
|
for (i = 0; i < dev->nregions; i++) {
|
||||||
|
@ -621,7 +621,7 @@ map_ring(VuDev *dev, VuVirtq *vq)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
generate_faults(VuDev *dev) {
|
generate_faults(VuDev *dev) {
|
||||||
int i;
|
unsigned int i;
|
||||||
for (i = 0; i < dev->nregions; i++) {
|
for (i = 0; i < dev->nregions; i++) {
|
||||||
VuDevRegion *dev_region = &dev->regions[i];
|
VuDevRegion *dev_region = &dev->regions[i];
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -829,7 +829,7 @@ static inline bool reg_equal(VuDevRegion *vudev_reg,
|
||||||
static bool
|
static bool
|
||||||
vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
|
vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
|
||||||
VhostUserMemoryRegion m = vmsg->payload.memreg.region, *msg_region = &m;
|
VhostUserMemoryRegion m = vmsg->payload.memreg.region, *msg_region = &m;
|
||||||
int i;
|
unsigned int i;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if (vmsg->fd_num > 1) {
|
if (vmsg->fd_num > 1) {
|
||||||
|
@ -895,7 +895,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
|
||||||
static bool
|
static bool
|
||||||
vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
|
vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
|
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
|
||||||
dev->nregions = memory->nregions;
|
dev->nregions = memory->nregions;
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
|
||||||
static bool
|
static bool
|
||||||
vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
|
vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
|
VhostUserMemory m = vmsg->payload.memory, *memory = &m;
|
||||||
|
|
||||||
for (i = 0; i < dev->nregions; i++) {
|
for (i = 0; i < dev->nregions; i++) {
|
||||||
|
@ -1980,7 +1980,7 @@ end:
|
||||||
void
|
void
|
||||||
vu_deinit(VuDev *dev)
|
vu_deinit(VuDev *dev)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < dev->nregions; i++) {
|
for (i = 0; i < dev->nregions; i++) {
|
||||||
VuDevRegion *r = &dev->regions[i];
|
VuDevRegion *r = &dev->regions[i];
|
||||||
|
|
Loading…
Reference in New Issue