Files
computing-offload/generic_vdpa/libvirt/Use-un-signed-printf-specifiers-correctly.patch
jiangdongxu 79c4324644 add generic_vdpa basecode
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
2024-09-19 17:19:46 +08:00

101 lines
3.4 KiB
Diff

From 37a05df2eb7e880c1bde301adf2b2eb32fc9a891 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Tue, 22 Sep 2020 22:17:03 +0200
Subject: [PATCH] Use (un)signed printf specifiers correctly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Various places reported by cppcheck's invalidPrintfArgType_sint
and invalidPrintfArgType_uint.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
(cherry-pick from 8b80d9f0f924ddf900b726871916f8ba5ae29243)
---
examples/c/domain/domtop.c | 2 +-
examples/c/domain/suspend.c | 2 +-
tests/qemusecuritymock.c | 2 +-
tests/virhashtest.c | 4 ++--
tests/virpcimock.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/examples/c/domain/domtop.c b/examples/c/domain/domtop.c
index 15611c586d..5228445b7c 100644
--- a/examples/c/domain/domtop.c
+++ b/examples/c/domain/domtop.c
@@ -115,7 +115,7 @@ parse_argv(int argc, char *argv[],
}
*milliseconds = val;
if (*milliseconds != val) {
- ERROR("Integer overflow: %ld", val);
+ ERROR("Integer overflow: %lu", val);
exit(EXIT_FAILURE);
}
break;
diff --git a/examples/c/domain/suspend.c b/examples/c/domain/suspend.c
index 980c4584c7..3ff24f6861 100644
--- a/examples/c/domain/suspend.c
+++ b/examples/c/domain/suspend.c
@@ -105,7 +105,7 @@ parse_argv(int argc, char *argv[],
}
*seconds = val;
if (*seconds != val) {
- ERROR("Integer overflow: %ld", val);
+ ERROR("Integer overflow: %lu", val);
return -1;
}
break;
diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c
index ad182c7bf7..e1057bef7b 100644
--- a/tests/qemusecuritymock.c
+++ b/tests/qemusecuritymock.c
@@ -269,7 +269,7 @@ mock_chown(const char *path,
int ret = -1;
if (gid >> 16 || uid >> 16) {
- fprintf(stderr, "Attempt to set too high UID or GID: %lld %lld",
+ fprintf(stderr, "Attempt to set too high UID or GID: %llu %llu",
(unsigned long long) uid, (unsigned long long) gid);
abort();
}
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index 4d05cbb0f8..af30791241 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -34,7 +34,7 @@ testHashInit(int size)
}
if (virHashTableSize(hash) != oldsize) {
- VIR_TEST_DEBUG("hash grown from %zd to %zd",
+ VIR_TEST_DEBUG("hash grown from %zu to %zu",
(size_t)oldsize, (size_t)virHashTableSize(hash));
}
}
@@ -313,7 +313,7 @@ testHashRemoveSet(const void *data G_GNUC_UNUSED)
if (count != rcount) {
VIR_TEST_VERBOSE("\nvirHashRemoveSet didn't remove expected number of"
- " entries, %d != %u",
+ " entries, %d != %d",
rcount, count);
goto cleanup;
}
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 92b6f810d8..d0fe11e5f1 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -120,7 +120,7 @@ struct pciDeviceAddress {
unsigned int device;
unsigned int function;
};
-# define ADDR_STR_FMT "%04x:%02x:%02x.%d"
+# define ADDR_STR_FMT "%04x:%02x:%02x.%u"
struct pciDevice {
struct pciDeviceAddress addr;
--
2.27.0