From nobody Mon Oct 19 15:29:30 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 4j7fbv2SPrz6vV1g for ; Mon, 19 Oct 2026 15:29:31 +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 4j7fbt6skrz4KV0 for ; Mon, 19 Oct 2026 15:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792423771; 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=tdf4e/FCleHTv8JEQYFcB8+u4/t73xjmL2wR6HbUJrg=; b=yzJq4JoflZh+qRCyRj5rY7KLFYJH3yhWABK6CprSFI0z7+AQYZthYZIexOQurem5/tXW3i GQ/axwfjZZdxgtHTySYJvmTM3qv/azhqi17zONjpmhKHHfSpqX33Sm0my07NZYeqGfFQMQ TXKg+1s2JEkSUIId/X8NW3BhSE6v4WlkEoMSIJhL8NjVChWZ7s3LbKuoRBUI361AcEAVEN I8H6N1W4INbbMOI2VZ9g5q9tEfOnBQcLYUWBuzmhkSG9TvakzJHropDaB/Ib/zBZ0074qR JA3mXo4dBZbYCnyNKeCS65XlNDpGzCGAtD+iXqwbpumYkCBsfXaFwVGC2u0YAA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792423771; b=C0qelpwG7iGfuRLwdIlr615x4oGUA63350LWUMMXh74FDg22Fc39M8wtJWti3BFZfksSg7 rgCuSI5ryq5jq79NNLGMuXishWT9fk5Kdy6nonHG3DkD/J4qnIr5Xrc/wm4fX7m0D7Xln1 clQKCsM+A2RXzIRa7n3KGxVYrRqQ8UQNurq4+DQqHsJWCoDat0pHAX/X0Lzzyij0Xt9Tpl abpbFmsMw4x/26MFHAkniefRrW/1SGW85DDstCHQZ0duKAYu64YhNzWAXuaKEXbFrvyi4T pVFdja7fCracK1tK4MrfhNb5m2OLDoGqNjOITv8AWcSKC8SDq98ExBrorlhk2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792423771; 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=tdf4e/FCleHTv8JEQYFcB8+u4/t73xjmL2wR6HbUJrg=; b=Nc5TSSRhO3ErImLH1li9DjTWA0kZcSmS8HzrQEFkjLJW1lMeVjVYajNOWgSTVLqnmHNHDR tT+xyrJI3SUiRrdX+4YTgQrV8evK8K3srqJR5PGesTlPcI13wlz/icmeLzZ6V3jACWUsQs yzGqNxoGL1oj+hTuh6QzeW97BSHMFdK98dK4rt4P0pO4lYuAkU9z3OVhC1rCUESLY2ziP1 AmblvZfslwYivJcceUkQ9ADBbqO5RKaOqG1toqCYSrmzq6J2CheXbiKNDDqsF32Hq5D0jq y+IcJ4xfuXGGRACmPzTcluQsj30s3iQMwXxv7nF43qJdiJV1Gnbn5L3B17yffQ== 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 4j7fbt5p8xzQ9R for ; Mon, 19 Oct 2026 15:29:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 44633 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 19 Oct 2026 15:29:30 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f1986e5b8863 - main - 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/main X-Git-Reftype: branch X-Git-Commit: f1986e5b88630b1404a202251499bca0f97f5f06 Auto-Submitted: auto-generated Date: Mon, 19 Oct 2026 15:29:30 +0000 Message-Id: <6ad6375a.44633.35bfd228@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f1986e5b88630b1404a202251499bca0f97f5f06 commit f1986e5b88630b1404a202251499bca0f97f5f06 Author: Mark Johnston AuthorDate: 2026-10-19 13:54:33 +0000 Commit: Mark Johnston CommitDate: 2026-10-19 15:29:13 +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 --- 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;