From nobody Tue Jan 2 01:12:59 2024 X-Original-To: dev-commits-src-branches@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 4T3vwq6McJz562dv; Tue, 2 Jan 2024 01:12:59 +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 4T3vwq3qw3z3Znx; Tue, 2 Jan 2024 01:12:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704157979; 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=ROozMbwON658wWYtsXntmys3x1X/W70GAzHz/6HHF9Q=; b=sOkBZ1pY6ISxNGgXkbIWoF0pRCj+S865hsdvScol9+FLLygznnUG2YdvYIdgEgpqrfC4Aw OxodMxfpnKwD/82sIoQYCeeTunv2KEMKEAllbFz1m7NqqHK35nqzNiAmcxB64HBvwd1JDL mjW6vBlqihdPmi+2gk7Db1tiRhMfXD2DY/4irv5Fl2kbNBtAL90jPejoMxxd+aUd0IrvXE rwpSCGl9CxuCGOTojTYcJQyIAbSHBC6no0nxIPGnjxfUrMmD65vNwr+6L6ie8QfS64/UGx /1HoAv0/RLgNVCqe2KFqqFkSRQyryjge8FoSctJfxQ1vs+KfKOquO83+7pK6FA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704157979; a=rsa-sha256; cv=none; b=OF/8cY0faaLs9QncAhlqkQCgMlOON5bb5bK/velOy4OPTLkEXXQ+IMcsC7WSe9OYwVRhtw sfp5IcWZseXJ7Pxwl5PF6zY+wuMC/PRXROHOPIheuVxjncNWUHncWeV8ulCyb7zLoR3YOE PkmycuJhVS3/z2XkXow346u94MvydqTZGn6VuC/Dc12GfWRIsnIOx2CZVGz+16f/p0rvDf /gB5jbVSpFowFsbyqnaGZKHPwtWlxb0TASla2kDm/8Y7vfpHpADf727ZkYgh6eAHYIOVDe wrZdlch/rLRo+a+TGxLPd8BBqyMg5jZmn80GaZ12eN/WkTR1VwmoT4OsczuFhQ== 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=1704157979; 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=ROozMbwON658wWYtsXntmys3x1X/W70GAzHz/6HHF9Q=; b=pzZ1S1QZQwBfU+s+N8okmT7ysRMIdQBKYJsQE4rWS9WPQkdH6w7PqXoa/KUchjdzCbIeAH ikhY+L3tuPVHIoZ4SyLNi+XFpT+tEuz6IrQo4Td7C6jSfP3QX4KHfGol8DJ2pnQQc2p6ud vMMKG0lhWUav4qC+Tj99Ao9gx2oUPNpr8t/mLF9Gsbq8Sguex4e39H1OQhGHGPUo2h/485 m8m173whW7/82W4x4p5jiN80mVvSZ/LukSMsmHL6HGkqwdDUb1R+VzwQ4jgZirlC8+6tPH JVJ535RrDFIGUSE1kyqeOujyaT5mJfVM0m+0smsyW4MZVVOcrtLfKknkeP4TRw== 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 4T3vwq2sDmzgdl; Tue, 2 Jan 2024 01:12:59 +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 4021CxOH054787; Tue, 2 Jan 2024 01:12:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4021Cx1T054784; Tue, 2 Jan 2024 01:12:59 GMT (envelope-from git) Date: Tue, 2 Jan 2024 01:12:59 GMT Message-Id: <202401020112.4021Cx1T054784@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: 6b067be54eda - stable/13 - compat_freebsd4: Check for errors from subyte() in freebsd4_uname() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 6b067be54eda23929e4ffaf8402471151b101856 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6b067be54eda23929e4ffaf8402471151b101856 commit 6b067be54eda23929e4ffaf8402471151b101856 Author: Mark Johnston AuthorDate: 2023-12-26 01:39:21 +0000 Commit: Mark Johnston CommitDate: 2024-01-02 01:12:44 +0000 compat_freebsd4: Check for errors from subyte() in freebsd4_uname() This is in preparation for adding a __result_use_check annotation to copyin() and related functions. Reviewed by: imp, kib, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43099 (cherry picked from commit 4f35450ce52a7b141e7ae8d37fa257b5f8971dda) --- sys/kern/kern_xxx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index 99fe9e6e71c9..8674dbf61361 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -334,7 +334,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->sysname + sizeof(uap->name->sysname) - 1, 0); + error = subyte(uap->name->sysname + sizeof(uap->name->sysname) - 1, 0); + if (error) + return (EFAULT); name[1] = KERN_HOSTNAME; len = sizeof uap->name->nodename; @@ -342,7 +344,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->nodename + sizeof(uap->name->nodename) - 1, 0); + error = subyte(uap->name->nodename + sizeof(uap->name->nodename) - 1, 0); + if (error) + return (EFAULT); name[1] = KERN_OSRELEASE; len = sizeof uap->name->release; @@ -350,7 +354,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->release + sizeof(uap->name->release) - 1, 0); + error = subyte(uap->name->release + sizeof(uap->name->release) - 1, 0); + if (error) + return (EFAULT); /* name = KERN_VERSION; @@ -383,7 +389,9 @@ freebsd4_uname(struct thread *td, struct freebsd4_uname_args *uap) 1, 0, 0, 0, 0); if (error) return (error); - subyte( uap->name->machine + sizeof(uap->name->machine) - 1, 0); + error = subyte(uap->name->machine + sizeof(uap->name->machine) - 1, 0); + if (error) + return (EFAULT); return (0); }