summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-08-02 06:52:05 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-08-02 06:52:05 -0700
commit0399521e53336bd2cdc15482bca0ffd3493fdff6 (patch)
tree68d20ea23972882284115217a85aa5a5fc73ab1f
parent9b00d2790195654ff21b649682cccaa6ae88ea0b (diff)
parent21b1d974595b3986c68fe80a1f7e9b87886d4bae (diff)
Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging
Block layer patches - libvduse: Coverity fixes - hd-geometry: Fix ignored bios-chs-trans setting - io_uring: Fix compiler warning (missing #include) - main loop: add missing documentation links to GS/IO macros - qemu-iotests: Discard stderr when probing devices # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmLpKDURHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9ZMcA//buzWQl/AFL2VT5Fy3WpFCYDVp5mTPJ2q # bgkhCpn6i7UXIkML53hygfm7LN9Fj8Q8Ld4ljkETzljJajS3zsXvyY6bgNevQutX # 8WvkcUNWMb96DEgetInak2ebH6lhti6/V7lBfjNFG1yC2s8l+JoWIPqWfJqohdiN # D4+loa/wQx1ZS3TgKq8zAxfi5qbbGxRTZQUvuCJNYRryRQmJsZH380DzlIqkRJWt # b3rM7m9ElSpmcmwmztWkdK4E/2VYGknUQOnRpY0AUSUTcm/kaP7EVwh61+TdjlKL # NZxvZ08kenGFTBEA9z3ahnggcLypj4IYU3DB29CiJLjMjCb0s7tMwc8USYajN+GA # iDqkbK14mDd8auRDVbVcmnq34xzS0rJocpzT0Jo9zYo7oGe/r+JjaVWmWq0pZ2SE # QQuSPZXZokUdpL6E5X05+JZ+u6+G+iQz9UOhNpwmKB1ajiXUVKIst/SctpyKedOr # cJWB34tQxQIFB57s6K7wVMbSWPIumTwQc08EX0HoicT9pUMN7s+Z1jrCufudZ0ot # gx95v7gBDZZDsJim5qi3znA8tqnUmtL0yxkUVgv7LdQfIleEnEFfutFJpq/7VFe9 # WRzXBQJPU451jF7Gvj/StA3+05qMr22mXW4CX6t96Ud6QHiR0mUBSGPRzYusIV4d # KYOjySU7cOg= # =axCN # -----END PGP SIGNATURE----- # gpg: Signature made Tue 02 Aug 2022 06:35:49 AM PDT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] * tag 'for-upstream' of git://repo.or.cz/qemu/kevin: main loop: add missing documentation links to GS/IO macros qemu-iotests: Discard stderr when probing devices hw/block/hd-geometry: Do not override specified bios-chs-trans libvduse: Pass positive value to strerror() libvduse: Replace strcpy() with strncpy() libvduse: Fix the incorrect function name block/io_uring: add missing include file Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--block/io_uring.c1
-rw-r--r--hw/block/hd-geometry.c7
-rw-r--r--include/qemu/main-loop.h18
-rw-r--r--subprojects/libvduse/libvduse.c13
-rw-r--r--tests/qemu-iotests/common.rc4
5 files changed, 31 insertions, 12 deletions
diff --git a/block/io_uring.c b/block/io_uring.c
index f8a19fd97f..a1760152e0 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include <liburing.h>
#include "block/aio.h"
+#include "qemu/error-report.h"
#include "qemu/queue.h"
#include "block/block.h"
#include "block/raw-aio.h"
diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
index 112094358e..dae13ab14d 100644
--- a/hw/block/hd-geometry.c
+++ b/hw/block/hd-geometry.c
@@ -150,7 +150,12 @@ void hd_geometry_guess(BlockBackend *blk,
translation = BIOS_ATA_TRANSLATION_NONE;
}
if (ptrans) {
- *ptrans = translation;
+ if (*ptrans == BIOS_ATA_TRANSLATION_AUTO) {
+ *ptrans = translation;
+ } else {
+ /* Defer to the translation specified by the user. */
+ translation = *ptrans;
+ }
}
trace_hd_geometry_guess(blk, *pcyls, *pheads, *psecs, translation);
}
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index 5518845299..c50d1b7e3a 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -279,7 +279,11 @@ bool qemu_mutex_iothread_locked(void);
*/
bool qemu_in_main_thread(void);
-/* Mark and check that the function is part of the global state API. */
+/*
+ * Mark and check that the function is part of the Global State API.
+ * Please refer to include/block/block-global-state.h for more
+ * information about GS API.
+ */
#ifdef CONFIG_COCOA
/*
* When using the Cocoa UI, addRemovableDevicesMenuItems() is called from
@@ -298,13 +302,21 @@ bool qemu_in_main_thread(void);
} while (0)
#endif /* CONFIG_COCOA */
-/* Mark and check that the function is part of the I/O API. */
+/*
+ * Mark and check that the function is part of the I/O API.
+ * Please refer to include/block/block-io.h for more
+ * information about IO API.
+ */
#define IO_CODE() \
do { \
/* nop */ \
} while (0)
-/* Mark and check that the function is part of the "I/O OR GS" API. */
+/*
+ * Mark and check that the function is part of the "I/O OR GS" API.
+ * Please refer to include/block/block-io.h for more
+ * information about "IO or GS" API.
+ */
#define IO_OR_GS_CODE() \
do { \
/* nop */ \
diff --git a/subprojects/libvduse/libvduse.c b/subprojects/libvduse/libvduse.c
index 9a2bcec282..1a5981445c 100644
--- a/subprojects/libvduse/libvduse.c
+++ b/subprojects/libvduse/libvduse.c
@@ -1193,7 +1193,7 @@ static int vduse_dev_init(VduseDev *dev, const char *name,
return 0;
}
-static inline bool vduse_name_is_valid(const char *name)
+static inline bool vduse_name_is_invalid(const char *name)
{
return strlen(name) >= VDUSE_NAME_MAX || strstr(name, "..");
}
@@ -1242,7 +1242,7 @@ VduseDev *vduse_dev_create_by_name(const char *name, uint16_t num_queues,
VduseDev *dev;
int ret;
- if (!name || vduse_name_is_valid(name) || !ops ||
+ if (!name || vduse_name_is_invalid(name) || !ops ||
!ops->enable_queue || !ops->disable_queue) {
fprintf(stderr, "Invalid parameter for vduse\n");
return NULL;
@@ -1257,7 +1257,7 @@ VduseDev *vduse_dev_create_by_name(const char *name, uint16_t num_queues,
ret = vduse_dev_init(dev, name, num_queues, ops, priv);
if (ret < 0) {
fprintf(stderr, "Failed to init vduse device %s: %s\n",
- name, strerror(ret));
+ name, strerror(-ret));
free(dev);
return NULL;
}
@@ -1276,7 +1276,7 @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id,
struct vduse_dev_config *dev_config;
size_t size = offsetof(struct vduse_dev_config, config);
- if (!name || vduse_name_is_valid(name) ||
+ if (!name || vduse_name_is_invalid(name) ||
!has_feature(features, VIRTIO_F_VERSION_1) || !config ||
!config_size || !ops || !ops->enable_queue || !ops->disable_queue) {
fprintf(stderr, "Invalid parameter for vduse\n");
@@ -1309,7 +1309,8 @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id,
goto err_dev;
}
- strcpy(dev_config->name, name);
+ strncpy(dev_config->name, name, VDUSE_NAME_MAX);
+ dev_config->name[VDUSE_NAME_MAX - 1] = '\0';
dev_config->device_id = device_id;
dev_config->vendor_id = vendor_id;
dev_config->features = features;
@@ -1330,7 +1331,7 @@ VduseDev *vduse_dev_create(const char *name, uint32_t device_id,
ret = vduse_dev_init(dev, name, num_queues, ops, priv);
if (ret < 0) {
fprintf(stderr, "Failed to init vduse device %s: %s\n",
- name, strerror(ret));
+ name, strerror(-ret));
goto err;
}
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 165b54a61e..db757025cb 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -982,7 +982,7 @@ _require_large_file()
#
_require_devices()
{
- available=$($QEMU -M none -device help | \
+ available=$($QEMU -M none -device help 2> /dev/null | \
grep ^name | sed -e 's/^name "//' -e 's/".*$//')
for device
do
@@ -994,7 +994,7 @@ _require_devices()
_require_one_device_of()
{
- available=$($QEMU -M none -device help | \
+ available=$($QEMU -M none -device help 2> /dev/null | \
grep ^name | sed -e 's/^name "//' -e 's/".*$//')
for device
do