From nobody Tue Dec 26 02:04:18 2023 X-Original-To: dev-commits-src-main@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 4SzdPG3pX4z55KZt; Tue, 26 Dec 2023 02:04:18 +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 4SzdPG2bT3z4KGJ; Tue, 26 Dec 2023 02:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703556258; 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=GLO+nybv6Vi4U+YKoYks15XHZVlJ7bHBH/5QSH2GVGc=; b=To8DDCd8Wv2LPlau+sO0VQYAKDRslmR746LEvTC4ylQ/NNFiV6XBjGq7E7+fOZs9QW3C7L aYf4SAb1tvM2BpfLBtjFnNTCrHEYjnt66ceIdvrNPvnJfDl5GJTfjMunvt4aNWUIUNwGbI N4Rzq2F3/iIKxS6KpaCBpxR5I01I2hrP7RHcnBHTV+54iPZeCknyy+PelTjVKiKsSVXVc/ iAVlfhI7ZGqYa544FjaAQalN211kXp06V0Qy/7oNTJ6ddq+ZnUt3qI3a69WFaEoglcfBgg 2xIVL9oC+ww9AxaRffhMxVN35y4hpHbXyvplw9MA9M6DmTgN0DXg17aI4SNutQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703556258; a=rsa-sha256; cv=none; b=lRr1O1i17CVdJdJ0Rwes/L2UwBm1rTcjeOxwUvqGt4ZAjRf+jIE5Pk1HPl0nozGCmJDF9r CkM/YTsUCl2MXy0fwVvfc0uhTyJhg4pulWZD2wzwnwnMWgUAhxKaEgM6APEVEN+VjbwyB3 52DDj65HO0kmSmv8leCPuE3Ic7S6udZ3jGCmPIm47NM5h1G7jnkNdBQW0WZMBCaoedxPfg juEYowyy4btAxKFWfv110YfdzpIi7i92YpSZglGD5/wnBLXb/V1ubhscFTCfwCJacMcqOk AVXz7uHElY+dTGDGEoTc+SfV4OHte5syeVAzssPgp976QQkY0/sakptCp+qPFA== 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=1703556258; 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=GLO+nybv6Vi4U+YKoYks15XHZVlJ7bHBH/5QSH2GVGc=; b=CQYI4vz5zKYUJj7CHS2kDOXZdxHJ+fEr/uVlE4mBYZnbHKzGae7NGQt1ZSz6UdaEbjRSNd qilcPexxtFhm9OgJjXro+WQRjZXdJKIVyWXVpZQ667B5pAO/sOTf1AQ2D6MWoa11Ce5E+v LSICRgZof+OFGHkexZ+0Z/ZUsBFAGZOgE44d7osaZbOuGQzWTY2v240wtmmjW7G22yyW/O egN1Rno0duEFD+2yGJzzy4h0mpFpUDvFXs+NT1RRcJVYWef6f4sdIZdtGGuu67iqXGBOsg A+2PPiPuX4PfmjMiBmRfNwcOoAnVvlAWn68UateoD2XUHGEuNTOKXfghET+syw== 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 4SzdPG1j7DzblB; Tue, 26 Dec 2023 02:04:18 +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 3BQ24I6N002957; Tue, 26 Dec 2023 02:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BQ24I4Z002954; Tue, 26 Dec 2023 02:04:18 GMT (envelope-from git) Date: Tue, 26 Dec 2023 02:04:18 GMT Message-Id: <202312260204.3BQ24I4Z002954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4f35450ce52a - main - compat_freebsd4: Check for errors from subyte() in freebsd4_uname() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 4f35450ce52a7b141e7ae8d37fa257b5f8971dda Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4f35450ce52a7b141e7ae8d37fa257b5f8971dda commit 4f35450ce52a7b141e7ae8d37fa257b5f8971dda Author: Mark Johnston AuthorDate: 2023-12-26 01:39:21 +0000 Commit: Mark Johnston CommitDate: 2023-12-26 02:04:00 +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 --- 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 540dc75b5545..e8331a5cdb1f 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -324,7 +324,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; @@ -332,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->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; @@ -340,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->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; @@ -373,7 +379,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); }