From nobody Tue Nov 29 10:39:09 2022 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 4NLzNF61PRz4jT1Z; Tue, 29 Nov 2022 10:39:09 +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 4NLzNF5KPxz3t9p; Tue, 29 Nov 2022 10:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669718349; 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=qjmVZBz/5JdBBxyZQlHIv17y0y2lUB+uarb+WW7+CQc=; b=oSQiWnYzeM1A2OWEvM/wunSgVz3uujA5Dr9/gFgZaTqjfW6RHulJT6fEv0JoOHKujcQcW8 qwmvm1uFpMbsIBslVeO5JQ0mm4ri6eRgufXdXcxTjHa+zZhsmRbMfiv0O0p/vUqyJziP58 wAN0v1nCRSPThry6nutH6GyxOP9wZbdwvzSjZGmKK7whhIRaw/6Jmfvp2hdX2bcTOc4K3M vqtpTWS4r15xcXG2Zh/dIaYIVv+Y2P3NULiP9LQUtbXzpc6Xj5nMBe3NYc7oASGJpYXj1l t2LvDn4AMi4OR7cz44Oe5LT29jg7Cu//U65KUllrZKcb1r6wPs1aKpA6lV61oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669718349; 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=qjmVZBz/5JdBBxyZQlHIv17y0y2lUB+uarb+WW7+CQc=; b=orgFskc+zsfB/gHsYxmUsYjWXX2C1j68GP89Z+i1UqCIGanz9nfUmHYPdxXd91qFeZbWX2 DcagCoqtEr8fB+ebEZcT8p5e+eQfD+G1Pdo7t2xaj7PMScTjt8lo1vURo4YtSAiG9CpPTN C34PSE8skYw0aQl6254hROm9WblUiPhsA0kYm1by+Pxh+869j5d3VSAMLoOi5YUY4YilMN LvZvIv8yqIAQwlVFkORS6GCNZchMxSOZDrp8HDXcL+qGo3s3Jll2AZu3ITov13fBC9WGHq sdNs0SGDaLUNsu/fagz9O9SnuTPwFbRdS8IznunfMJMfQmAxZvpA3b6zuB+gYA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669718349; a=rsa-sha256; cv=none; b=eJxl7cn0QS1tN450i6AJ9XQV43UiNAO6NGTDJy49Z48YpzWoCNwo94+MOmTMs6ZukkJ13/ H9NrPwEqLexKbJ21npwYKhQWwsj0srmSkmOsecTyl8m3xFHitZbcOlD7dS1KaTRsVgOcb1 5KSvN4wtU+4HzN9DuFAgqr4rec1NK5EvsHpb27NR5AkCpNGbL7tItEyDhoTGFqqT1HPUD9 0PrHdPml7V3mN/JO2wZM5oiv8N5CaVHwIRSVg/DEO7+Cz+umurzhTSkeCs5O6UxNS/yzVi n7eSXsJKn/UGvSLStbFZP2E1PlfTwBvrXxi4tPgRfo0MUQOfzPHM7s9Y+PXueA== 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 4NLzNF4RT4zFDM; Tue, 29 Nov 2022 10:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ATAd9hl045115; Tue, 29 Nov 2022 10:39:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ATAd9um045114; Tue, 29 Nov 2022 10:39:09 GMT (envelope-from git) Date: Tue, 29 Nov 2022 10:39:09 GMT Message-Id: <202211291039.2ATAd9um045114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 18057f471dc4 - stable/13 - linuxkpi: Add strndup_user 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: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 18057f471dc46ddb10e18c36cf7f644d38e1dddf Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=18057f471dc46ddb10e18c36cf7f644d38e1dddf commit 18057f471dc46ddb10e18c36cf7f644d38e1dddf Author: Jake Freeland AuthorDate: 2022-09-20 17:38:37 +0000 Commit: Emmanuel Vadot CommitDate: 2022-11-29 10:09:38 +0000 linuxkpi: Add strndup_user Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022) (cherry picked from commit a11195df34f7b14740447869263d3acf8d72af42) --- sys/compat/linuxkpi/common/include/linux/string.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 95a9d5a76594..932bed81d034 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -98,6 +98,15 @@ kmemdup(const void *src, size_t len, gfp_t gfp) return (dst); } +static inline char * +strndup_user(const char __user *ustr, long n) +{ + if (n < 1) + return (ERR_PTR(-EINVAL)); + + return (memdup_user_nul(ustr, n - 1)); +} + static inline char * kstrdup(const char *string, gfp_t gfp) {