aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/guest-random.c2
-rw-r--r--util/mmap-alloc.c2
-rw-r--r--util/qemu-option.c2
-rw-r--r--util/uri.c22
4 files changed, 9 insertions, 19 deletions
diff --git a/util/guest-random.c b/util/guest-random.c
index 086115bd67..23643f86cc 100644
--- a/util/guest-random.c
+++ b/util/guest-random.c
@@ -38,7 +38,7 @@ static int glib_random_bytes(void *buf, size_t len)
}
if (i < len) {
x = g_rand_int(rand);
- __builtin_memcpy(buf + i, &x, i - len);
+ __builtin_memcpy(buf + i, &x, len - i);
}
return 0;
}
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 838e286ce5..893d864354 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -225,6 +225,8 @@ static void *mmap_activate(void *ptr, size_t size, int fd,
"crash.\n", file_name);
g_free(proc_link);
g_free(file_name);
+ warn_report("Using non DAX backing file with 'pmem=on' option"
+ " is deprecated");
}
/*
* If mmap failed with MAP_SHARED_VALIDATE | MAP_SYNC, we will try
diff --git a/util/qemu-option.c b/util/qemu-option.c
index ee78e42216..61cb4a97bd 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -997,8 +997,6 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
return NULL;
}
- assert(opts != NULL);
-
for (entry = qdict_first(qdict);
entry;
entry = qdict_next(qdict, entry)) {
diff --git a/util/uri.c b/util/uri.c
index 8bdef84120..ff72c6005f 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1340,7 +1340,7 @@ static void uri_clean(URI *uri)
/**
* uri_free:
- * @uri: pointer to an URI
+ * @uri: pointer to an URI, NULL is ignored
*
* Free up the URI struct
*/
@@ -1939,15 +1939,9 @@ step_7:
val = uri_to_string(res);
done:
- if (ref != NULL) {
- uri_free(ref);
- }
- if (bas != NULL) {
- uri_free(bas);
- }
- if (res != NULL) {
- uri_free(res);
- }
+ uri_free(ref);
+ uri_free(bas);
+ uri_free(res);
return val;
}
@@ -2190,12 +2184,8 @@ done:
if (remove_path != 0) {
ref->path = NULL;
}
- if (ref != NULL) {
- uri_free(ref);
- }
- if (bas != NULL) {
- uri_free(bas);
- }
+ uri_free(ref);
+ uri_free(bas);
return val;
}