qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] Trivial patches for 2025-11-21
@ 2025-11-21 12:54 Michael Tokarev
  2025-11-21 12:54 ` [PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2) Michael Tokarev
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael Tokarev @ 2025-11-21 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Tokarev, qemu-trivial

The following changes since commit 5a5b06d2f6f71d7789719b97143fc5b543bec07a:

  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)

are available in the Git repository at:

  https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches

for you to fetch changes up to 5f9ac963735598c1efbdce9c4a09f0a64e13d613:

  Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)

----------------------------------------------------------------
trivial patches for 2025-11-21
Just 3 patches so far, but since we're reaching a
release, there's no point at waiting longer :)

----------------------------------------------------------------
Jack Wang (1):
      qmp: Fix a typo for a USO feature

Michael Tokarev (1):
      qga: use access(2) to check for command existance instead of questionable stat(2)

Yanghang Liu (1):
      Fix the typo of vfio-pci device's enable-migration option

 hw/vfio/pci.c          |  2 +-
 hw/virtio/virtio-qmp.c |  2 +-
 qga/commands-posix.c   | 12 +++---------
 3 files changed, 5 insertions(+), 11 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2)
  2025-11-21 12:54 [PULL 0/3] Trivial patches for 2025-11-21 Michael Tokarev
@ 2025-11-21 12:54 ` Michael Tokarev
  2025-11-21 12:54 ` [PULL 2/3] qmp: Fix a typo for a USO feature Michael Tokarev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2025-11-21 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Tokarev, qemu-trivial

The code checks existance of a command (halt/poweroff/reboot) by using
stat(2) and immediately checking for S_ISLNK() on the returned stat
struct.  This check will never be true, because stat(2) always follows
symbolic links and hence will either return ENOENT (in case of dangling
symlink) or the properties for the final target file.  It is lstat(2)
which might return information about the symlink itself.  However, even
there, we want to check the final file properties, not the first symlink.

This check - S_ISLNK - is harmful but useless in this case.  However, it
is confusing and it helps the wrong usage of stat(2) to spread, so it is
better to remove it.

Additionally, the code would better to check for the executable bits
of the final file, not check if it's a regular file - it's sort of
dubious to have anything but regular files in /sbin/.

But a POSIX system provides another command which suits the purpose
perfectly: it is access(2).  And it is so simple that it's not
necessary to create a separate function when usin it.

Replace stat(2) with access(X_OK) to check for file existance in
qga/commands-posix.c

Fixes: c5b4afd4d56e "qga: Support guest shutdown of BusyBox-based systems"
Reviewed-by: Rodrigo Dias Correa <r@drigo.nl>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qga/commands-posix.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 66f3e6f673..837be51c40 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -216,12 +216,6 @@ out:
     return retcode;
 }
 
-static bool file_exists(const char *path)
-{
-    struct stat st;
-    return stat(path, &st) == 0 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode));
-}
-
 #define POWEROFF_CMD_PATH "/sbin/poweroff"
 #define HALT_CMD_PATH "/sbin/halt"
 #define REBOOT_CMD_PATH "/sbin/reboot"
@@ -248,17 +242,17 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
 
     slog("guest-shutdown called, mode: %s", mode);
     if (!mode || strcmp(mode, "powerdown") == 0) {
-        if (file_exists(POWEROFF_CMD_PATH)) {
+        if (access(POWEROFF_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = POWEROFF_CMD_PATH;
         }
         shutdown_flag = powerdown_flag;
     } else if (strcmp(mode, "halt") == 0) {
-        if (file_exists(HALT_CMD_PATH)) {
+        if (access(HALT_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = HALT_CMD_PATH;
         }
         shutdown_flag = halt_flag;
     } else if (strcmp(mode, "reboot") == 0) {
-        if (file_exists(REBOOT_CMD_PATH)) {
+        if (access(REBOOT_CMD_PATH, X_OK) == 0) {
             shutdown_cmd = REBOOT_CMD_PATH;
         }
         shutdown_flag = reboot_flag;
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] qmp: Fix a typo for a USO feature
  2025-11-21 12:54 [PULL 0/3] Trivial patches for 2025-11-21 Michael Tokarev
  2025-11-21 12:54 ` [PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2) Michael Tokarev
@ 2025-11-21 12:54 ` Michael Tokarev
  2025-11-21 12:54 ` [PULL 3/3] Fix the typo of vfio-pci device's enable-migration option Michael Tokarev
  2025-11-23 23:27 ` [PULL 0/3] Trivial patches for 2025-11-21 Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2025-11-21 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jack Wang, qemu-trivial, Michael Tokarev

From: Jack Wang <jinpu.wang@ionos.com>

There is a copy & paste error, USO6 should be there.

Fixes: 58f81689789f ("qmp: update virtio feature maps, vhost-user-gpio introspection")
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/virtio-qmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c
index b338344c6c..968299fda0 100644
--- a/hw/virtio/virtio-qmp.c
+++ b/hw/virtio/virtio-qmp.c
@@ -299,7 +299,7 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {
     FEATURE_ENTRY(VIRTIO_NET_F_GUEST_USO4, \
             "VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv4"),
     FEATURE_ENTRY(VIRTIO_NET_F_GUEST_USO6, \
-            "VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv6"),
+            "VIRTIO_NET_F_GUEST_USO6: Driver can receive USOv6"),
     FEATURE_ENTRY(VIRTIO_NET_F_HOST_USO, \
             "VIRTIO_NET_F_HOST_USO: Device can receive USO"),
     FEATURE_ENTRY(VIRTIO_NET_F_HASH_REPORT, \
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] Fix the typo of vfio-pci device's enable-migration option
  2025-11-21 12:54 [PULL 0/3] Trivial patches for 2025-11-21 Michael Tokarev
  2025-11-21 12:54 ` [PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2) Michael Tokarev
  2025-11-21 12:54 ` [PULL 2/3] qmp: Fix a typo for a USO feature Michael Tokarev
@ 2025-11-21 12:54 ` Michael Tokarev
  2025-11-23 23:27 ` [PULL 0/3] Trivial patches for 2025-11-21 Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Tokarev @ 2025-11-21 12:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yanghang Liu, qemu-trivial, Michael Tokarev

From: Yanghang Liu <yanghliu@redhat.com>

Signed-off-by: Yanghang Liu <yanghliu@redhat.com>
Reported-by: Mario Casquero <mcasquer@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/vfio/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 8b8bc5a421..b46b1305a7 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3871,7 +3871,7 @@ static void vfio_pci_class_init(ObjectClass *klass, const void *data)
                                           "(DEBUG)");
     object_class_property_set_description(klass, /* 5.2, 8.0 non-experimetal */
                                           "enable-migration",
-                                          "Enale device migration. Also requires a host VFIO PCI "
+                                          "Enable device migration. Also requires a host VFIO PCI "
                                           "variant or mdev driver with migration support enabled");
     object_class_property_set_description(klass, /* 8.1 */
                                           "vf-token",
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] Trivial patches for 2025-11-21
  2025-11-21 12:54 [PULL 0/3] Trivial patches for 2025-11-21 Michael Tokarev
                   ` (2 preceding siblings ...)
  2025-11-21 12:54 ` [PULL 3/3] Fix the typo of vfio-pci device's enable-migration option Michael Tokarev
@ 2025-11-23 23:27 ` Richard Henderson
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2025-11-23 23:27 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: qemu-trivial

On 11/21/25 04:54, Michael Tokarev wrote:
> The following changes since commit 5a5b06d2f6f71d7789719b97143fc5b543bec07a:
> 
>    Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2025-11-20 08:12:59 +0100)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/mjt0k/qemu.git tags/pull-trivial-patches
> 
> for you to fetch changes up to 5f9ac963735598c1efbdce9c4a09f0a64e13d613:
> 
>    Fix the typo of vfio-pci device's enable-migration option (2025-11-21 15:53:06 +0300)
> 
> ----------------------------------------------------------------
> trivial patches for 2025-11-21
> Just 3 patches so far, but since we're reaching a
> release, there's no point at waiting longer :)

Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.

r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-23 23:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-21 12:54 [PULL 0/3] Trivial patches for 2025-11-21 Michael Tokarev
2025-11-21 12:54 ` [PULL 1/3] qga: use access(2) to check for command existance instead of questionable stat(2) Michael Tokarev
2025-11-21 12:54 ` [PULL 2/3] qmp: Fix a typo for a USO feature Michael Tokarev
2025-11-21 12:54 ` [PULL 3/3] Fix the typo of vfio-pci device's enable-migration option Michael Tokarev
2025-11-23 23:27 ` [PULL 0/3] Trivial patches for 2025-11-21 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).