From nobody Tue Jan 02 00:37:36 2024 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 4T3v805hd5z55ypk; Tue, 2 Jan 2024 00:37:36 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T3v803XtNz3JKl; Tue, 2 Jan 2024 00:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704155856; 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=mAGVT9FAe93i0PGDhLhEdne0iE/RAAW6Pnpi2B8alQE=; b=AcOMd0EmgJg80KiNUJhQDOBH8ykNoRHhU4V/GLigNBXZbyeq+9YMT7svXJFmlL3QgTFAA2 M/nHobNsdxOES0on3yL8G4ScXJaGQjdIFBaBGPlY0mQMdz2FmJdP2K7O0hqoOIP6Z434wr B6Y7fEVfrwAOKYcZMQwYY//uR/mCNZSg4FmFoI+h5Cl+mX5QOfOdA+gu6f86Cn1pi5+SWR BXV4xXJHupgnyNSYzWWv2P2P0gGyPDjk7mD0JsoLS1EkCol9OymYPnUvNNuLDX0DVgj2cx 2JgWQyaIlkfRdCxHegs40AuKt+ctm+xY7AV0We/BAsXokY4CdxbqWy7aRPTncw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704155856; a=rsa-sha256; cv=none; b=uvafvzU14s4vRIao+vrhk3tyOi7paGvFeNVM48OAOUoXtTcNoariQQkvt5BSgX6l/Nj2LO n1C8sjucOmfRsi1rSFAFlN0XJ2EG1+sgkiQPgj5CyITZW0d/mh+ztkWZNY9UoIsQF9U+qk YhT6wTs82u8U730cD53j43hdbsKIdXj4Om7EMUPJGCAK7TLQW03DDzeuX7CdCtJCN5K8ut BWZVS2uOG8Qg3cY6+Act6ZqmBe+4VWXp1dGwO+xgzLnSP+ir0yvPKPKktwTAe4XYDAiw+d 7u5K7CLjpYOD226dwf+0zdRrIzzVr/fu8h1gSDxTBAwP7whqU3p7DbH4/Oyn3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704155856; 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=mAGVT9FAe93i0PGDhLhEdne0iE/RAAW6Pnpi2B8alQE=; b=RIxyaD/0G8z2zOZxfEi6BSWLdTJaMIgplRQw/7Q2ARpAQW65QZsDhFMp5TzAK3DHnBwNTV Ra0D9Xx1rCdkduSp7SyCayxRpJPntvCnAOxeFkO3AIwAFR42NyejgqYossYawnEXAStx2s XBirbVmFeJrbeQypQvQfw79wLr+OEGDJ/5pTUoY7HCbS1xRneeDiEGmb63rDdywDlQhcVh +VkUM69fn3A4gvZ3YIT1yiB2xpacfheDAc9noMvMK/hlnJ1jkyf2kpS/Nbh9yBKWOB5HN3 0TEvVvLjmrsYYV7UI/CowvNXwPtGxOJs1nu7GPAzTNcCkhkp6nMhSPrfKgTLWQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T3v802fdJzflx; Tue, 2 Jan 2024 00:37:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4020baId085994; Tue, 2 Jan 2024 00:37:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4020baVt085991; Tue, 2 Jan 2024 00:37:36 GMT (envelope-from git) Date: Tue, 2 Jan 2024 00:37:36 GMT Message-Id: <202401020037.4020baVt085991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 266eefe7f465 - stable/14 - vmm: Fix handling of errors from subyte() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 266eefe7f465cf99d592a47a1905f7ecd9f7e9bd Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=266eefe7f465cf99d592a47a1905f7ecd9f7e9bd commit 266eefe7f465cf99d592a47a1905f7ecd9f7e9bd Author: Mark Johnston AuthorDate: 2023-12-26 01:43:51 +0000 Commit: Mark Johnston CommitDate: 2024-01-02 00:30:00 +0000 vmm: Fix handling of errors from subyte() subyte() returns -1 upon an error, not an errno value. MFC after: 1 week Fixes: e17eca327633 ("vmm: Avoid embedding cpuset_t ioctl ABIs") (cherry picked from commit 6adf554abd1c848d2c9ab7ea8a7fb7dd20a0c186) --- sys/amd64/vmm/vmm_dev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index cae15d7059cb..5214cd3f1447 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -629,10 +629,12 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, p = (uint8_t *)vmrun->cpuset + sizeof(cpuset_t); - while (error == 0 && - p < (uint8_t *)vmrun->cpuset + + while (p < (uint8_t *)vmrun->cpuset + vmrun->cpusetsize) { - error = subyte(p++, 0); + if (subyte(p++, 0) != 0) { + error = EFAULT; + break; + } } } }