From nobody Fri Nov 13 22:07:56 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 4jRBG44hyyz6yCLM for ; Fri, 13 Nov 2026 22:07:56 +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 4jRBG41bpQz3KWX for ; Fri, 13 Nov 2026 22:07:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794607676; 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=V503poGsqe8GgjCfG53VXSdv29lm30PWkiddFcN6YXE=; b=FXD2HOO/JrtI6cPPPI3JQHcMUnl9AYF/iNl9xg5ZuNuJ814zvSZ7HBsLBBI0+o21Fs2H++ NG+t991hjWl6ZQcyT8iMnHn/1JaO9DcevOIm0Kz92/TQNoM1XX0aNl0Tb/JUXwvQ8FNdzR qcG7Mhtvkknl+3jQnNDDquei7LJ8czMGL2Zn4YkgpVeUVumW7LC6M5Qhuo6j8p+bT00Zeb 89fxLP1MaDcnqvcAQ1/GMMh3C1UBPfEeNTLZMRca5EGfl0FwfXL6Tsbv2m6ttqwKn/6OvH gFGXwgwDGrNOUgMZHl2scHUX3xGlh4y7IT+vQAwRRdisGvaqbvHbf688N7iT4A== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794607676; b=yGtCalyUjppcPYEZZugMULPr2OSCA2rSnBmn9Yrq945UrKyOFLS1hy1rEPIrQesaeZm4q4 1zaO136R54VXTw/sgjTfGV8/IfjJ9jy2CrI80YV4t5pnvdjrAHhmMqQu0yk7Zy6vP0XWZG FwnjeUEIkmrlPxyAUs7T1nrtrETA5tcwvhJ+AYsRtm2I3MiXWyVLla8xfvBCR6pzEb5i0z aI3IPMHtJHw+AewmNeowiEJXvFFi7ITjT/Npl1HroUIc1F9ZUq4YzT97DhMPeuHSPRScG1 nypChNJN6xdKeXP3pUVNrnxpmmt4sAFKfvi/IiBPs/swA4UJ06XEL2VNkMvRCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794607676; 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=V503poGsqe8GgjCfG53VXSdv29lm30PWkiddFcN6YXE=; b=g4sPTWHU5dRDoccPN87ScdgT12sOvheaXD06RjEB83bSp++v7QCtHMDYMp5AIg9e1PrNS9 vY6iX9kzCuzqHNnTvDn/HuWQdFX1jvTlACkUjvTo3yVW8RCnpqCOcGIRr3seF3Z4ix9/+z i9Ktsp7FWDxK3O3Owzz+kOgPrqJS+/wnLcpUXeT8jAf7v1uJSmGgdr2eqFzcKV01g1NmM/ StxheuF16muqYdvCmMaq9yMmvOwJlKONdmrLJUtSMsr+i1mfSF7/Q94cZ8yjM8px5We0A7 bURbjrmBHDzrGxKBoa8IEdqnFBsXvKJ4z+ohdFC6dslJ8D447ZEQ7iISrZMnqg== 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 4jRBG40yKTztl3 for ; Fri, 13 Nov 2026 22:07:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id e71d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 22:07:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fcbc3ae445c5 - stable/14 - 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 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/14 X-Git-Reftype: branch X-Git-Commit: fcbc3ae445c5e848a31a248e9d161ddc9dae2414 Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 22:07:56 +0000 Message-Id: <6af78a3c.e71d.31981a@gitrepo.freebsd.org> The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fcbc3ae445c5e848a31a248e9d161ddc9dae2414 commit fcbc3ae445c5e848a31a248e9d161ddc9dae2414 Author: Mark Johnston AuthorDate: 2026-10-19 13:54:33 +0000 Commit: Mark Johnston CommitDate: 2026-11-13 22:07:32 +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 389e6d2e9313..8f4559a7132c 100644 --- a/usr.sbin/bhyve/pci_virtio_input.c +++ b/usr.sbin/bhyve/pci_virtio_input.c @@ -468,19 +468,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 */ @@ -585,8 +580,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;