All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-console: skip NUL terminator in port name
@ 2026-11-30 13:07 Manos Pitsidianakis
  2026-11-30 13:31 ` Tommaso Califano
  2026-11-30 17:24 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 9+ messages in thread
From: Manos Pitsidianakis @ 2026-11-30 13:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Laurent Vivier, Amit Shah, Michael S. Tsirkin,
	Manos Pitsidianakis

VIRTIO spec says:

   VIRTIO_CONSOLE_PORT_NAME (7)

      Sent by the device to give a tag to the port. This control command is immediately followed by the UTF-8 name of the port for identification within the guest (without a NUL terminator).

  -  Section 5.3.6.2 Multiport Device Operation

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
---
 hw/char/virtio-serial-bus.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 7fe90571249f1cbdb9a9d095f041d4e048ea506e..cfc48fc1d4ab625b60a59ed840f2f0eb0bd47629 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -473,12 +473,11 @@ static void handle_control_message(VirtIOSerial *vser,
             virtio_stw_p(vdev, &cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
             virtio_stw_p(vdev, &cpkt.value, 1);
 
-            buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
+            buffer_len = sizeof(cpkt) + strlen(port->name);
             buffer = g_malloc(buffer_len);
 
             memcpy(buffer, &cpkt, sizeof(cpkt));
             memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
-            buffer[buffer_len - 1] = 0;
 
             send_control_msg(vser, buffer, buffer_len);
             g_free(buffer);

---
base-commit: 9cda597a1a3903d090e8e55e23f5b8a859da88ab
change-id: 20261130-fix-virtio-console-port-name-32be73542009

Best regards,
-- 
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>



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

end of thread, other threads:[~2026-12-01 11:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 13:07 [PATCH] virtio-console: skip NUL terminator in port name Manos Pitsidianakis
2026-11-30 13:31 ` Tommaso Califano
2026-11-30 13:40   ` Manos Pitsidianakis
2026-11-30 13:45     ` Peter Maydell
2026-11-30 18:07       ` Michael S. Tsirkin
2026-11-30 17:24 ` Philippe Mathieu-Daudé
2026-12-01  5:35   ` Manos Pitsidianakis
2026-12-01 10:52     ` Philippe Mathieu-Daudé
2026-12-01 11:02       ` Manos Pitsidianakis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.