From nobody Fri Nov 06 19:54:55 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jLqdq3WqWz6yf0m for ; Fri, 06 Nov 2026 19:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jLqdq0sTDz4FNL for ; Fri, 06 Nov 2026 19:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793994895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QbFYWtBCtS3qxMwpL0IlDsphj5bajrTUYpOLE2rEKbo=; b=B4Uq1zCjp6kpJ1XIjaOAIgguomhQ4V19wXlvAvopaD377aEV2b22aSeYK27FqUnUTv/Jyu Uk0+ZNUmvICQoc0R4AlReXb4qel5zzaqmn/WmqSev/rNfGL46CPv1mQmkDSWB5WYtax5+5 Bj5OvidhMNHHOhrTfwGZPqNzx1cEzXhtTbeijOXRjgNA5UiV7yaoVdyhPDP6+TPklp95o1 xUV1fwigMZRqtUIzf9iCQdEYEYUFkupX8TIlUH/auIpk9xQF9EHgGzom7rE9qUTEsJH7D0 XEkU3VdMXFX0kqIro93fMknC9EqdEIoga7Vsuoy2KiGXhZ7/qn8m4GOKfoCkcQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793994895; b=uayN8vuYHH04avjDs4PzsGrPtu9TLYFesVV8EUlnm1E93Y82+XdLo1OqW0B0+jLhhNupOz iDKjN9ZtkGAXrGfOQ2NlB4SMJ59bG5FMHrAkqDGBcfP9mJBRMJbepvgGC7IBUrqyTKmuoH l80keccNXApnpZ/WmrNg29NCfMV7upralosYt0cRaGwOD8mgDo0/T9TOsHRmh8FvoePhFO jXY5v+UC4Ai0njrcGo0wyVzIIMXjcdlrZd4UfBouvzAyWQd7I0JSQAUfPy4oc8W6cSXMhB soqesX6jgYaQkr9A7Z0UDk/lhvCxpdaQTbpDFcJJYPZ2jyFj6ICOk+ZJobzT1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793994895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QbFYWtBCtS3qxMwpL0IlDsphj5bajrTUYpOLE2rEKbo=; b=nd9GU40BPhabrWL9pvE/KTWfgGB6nooKcNNLIwY44Q+SmvVInfjO1p+eVr6jViW52nYC44 A8O9eFw0fTgjZOnIHS2OrpYOAaOlXcekBt0DF975fzMVmlSnb2UTJrC5bX1/UWWnsX67ml 3qW+1TE3lMmoPhhwJq9TGr4EF8/qb8uAFKQctC+xv7QNOhKcWuWNfgMBPq9iIX5lFUdhq6 8FGZtkImOGHk3hU9uRz0Z4YhtsrfIac1eAXmFnIgHZj32E8uq4dfBqTw2pTJfj2MWxCGa+ +VheXtHj73kHxf08XVLP9ulVNnOkgXnh85pK6GZg5OF1RAZOePZAYp/rEGiCrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jLqdq0KBJzs2F for ; Fri, 06 Nov 2026 19:54:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1df40 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 06 Nov 2026 19:54:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 077a58317f1a - stable/15 - bhyve: Fix virtio-input event array resizing List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 077a58317f1a3b54077306b6f76252a53a9af439 Auto-Submitted: auto-generated Date: Fri, 06 Nov 2026 19:54:55 +0000 Message-Id: <6aee308f.1df40.33bbc4c9@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=077a58317f1a3b54077306b6f76252a53a9af439 commit 077a58317f1a3b54077306b6f76252a53a9af439 Author: Mark Johnston AuthorDate: 2026-10-19 13:54:33 +0000 Commit: Mark Johnston CommitDate: 2026-11-06 15:52:19 +0000 bhyve: Fix virtio-input event array resizing Use the new array size when calling realloc(). Note that this queue stores events read from a host evdev device, i.e., it is not guest-controlled. While here, use the cdefs.h __unused macro and use them correctly, i.e., don't mark "arg" as unused when it isn't. Reported by: Brian Delgado from Intel using Anthropic Opus 4.8 Fixes: 054accac71e0 ("Add a virtio-input device emulation.") MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D60679 (cherry picked from commit f1986e5b88630b1404a202251499bca0f97f5f06) --- usr.sbin/bhyve/pci_virtio_input.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/usr.sbin/bhyve/pci_virtio_input.c b/usr.sbin/bhyve/pci_virtio_input.c index 2da773df90be..29acdbfdfc16 100644 --- a/usr.sbin/bhyve/pci_virtio_input.c +++ b/usr.sbin/bhyve/pci_virtio_input.c @@ -467,19 +467,14 @@ static int vtinput_eventqueue_add_event( struct vtinput_eventqueue *queue, struct input_event *e) { - /* check if queue is full */ if (queue->idx >= queue->size) { - /* alloc new elements for queue */ - const uint32_t newSize = queue->idx; - void *newPtr = realloc(queue->events, - queue->size * sizeof(struct vtinput_event_elem)); - if (newPtr == NULL) { - WPRINTF(("%s: realloc memory for eventqueue failed!", - __func__)); + const size_t nsize = queue->idx + VTINPUT_MAX_PKT_LEN; + void *ptr = realloc(queue->events, + nsize * sizeof(struct vtinput_event_elem)); + if (ptr == NULL) return (1); - } - queue->events = newPtr; - queue->size = newSize; + queue->events = ptr; + queue->size = nsize; } /* save event */ @@ -584,8 +579,7 @@ vtinput_read_event_from_host(int fd, struct input_event *event) } static void -vtinput_read_event(int fd __attribute((unused)), - enum ev_type t __attribute__((unused)), void *arg __attribute__((unused))) +vtinput_read_event(int fd __unused, enum ev_type t __unused, void *arg) { struct pci_vtinput_softc *sc = arg;