From nobody Tue Sep 20 18:13:56 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 4MX8nJ36Glz4d1WQ; Tue, 20 Sep 2022 18:13: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 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 4MX8nJ2L50z3yKQ; Tue, 20 Sep 2022 18:13:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663697636; 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=jYhG+R91TjFm0rG52fTwX1uItRQA3/8dqNoXKHpks88=; b=GYtCUoG52X1GY+UYKpv/mC20AodUM2Iosm6JUVZRpHsGilyKyGnlqdIWuGoOY2H5u1qUT3 2WBmDFFlr2bHlLHhw1m+F8OsIdMybR4E77pEGB5ZmSTYZ/IFA87eg2awsntE/YPvp0dPeU sf5qKYtwIlGlq59AN9EbXcOuO4WDtTTzrq9LMKbJBPkpjKEhyCaxrXn5GouwhsusRej/xr tyxj79I6daAPNHvpoPvTq6tUhlLCyccpa3+3ZDiKK4gHegFxz+JDA1ra2Ecp+AwRQXDros Ya/EdjwGPNEFqMBhbXV5hRr/tMme2NJXTcYV49w/LZaom31MBvVE1OKVBhN4lA== 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 4MX8nJ1N3zzp4B; Tue, 20 Sep 2022 18:13:56 +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 28KIDuS2022794; Tue, 20 Sep 2022 18:13:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28KIDueC022793; Tue, 20 Sep 2022 18:13:56 GMT (envelope-from git) Date: Tue, 20 Sep 2022 18:13:56 GMT Message-Id: <202209201813.28KIDueC022793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: a11195df34f7 - main - 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/main X-Git-Reftype: branch X-Git-Commit: a11195df34f7b14740447869263d3acf8d72af42 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663697636; 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=jYhG+R91TjFm0rG52fTwX1uItRQA3/8dqNoXKHpks88=; b=PGWR/Mj1RHghrM3Jp1YbHBKGSWx9slMtTUgaLtLd7M89TvvIIS2NvHJaEKQFB2XhjU65kr B6/veeZCuHftRg/0dRirKZQV72WNkIOW2D48vpVeV9bG7w6YUl/QXvIzQ2ohTjCr7GRssq mzYQLstsg6MMpdDShcuJvDVkPu40txcTgOEoZWlPCuKzb4fxW+GMOvI8OSDd/pBZlfrz7X wzs796sdDp2meP5FM0urvh7llGTILEYKq5OjEpjK0ASZYq0ypJjxRwwcjOtZvOD7qCIHuT FP7fDn8hrWT+1IljrKVcj6KWY+GaAK9ZPytwKjJOcMRE6mt+yL2N3sCMdm9Y0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663697636; a=rsa-sha256; cv=none; b=nDnIBEvnLOBVttp0PuPQQtxLvh/xligebWoJ/ATgv3tZE7tFwrnaxj2iP0wItaFjN1rghO bDyhJ52uAQzNYu18Mh/82joHJOPAMpUjifJVPaB/ziuh2qwxZ1cx/4YyvmRsXJBGI1HRGy vJrVj9oPAf1ACfDMFV4M2Fkkjp7vBcMADvrBDd5XYSpwfZl1aB5e3vYCjbwX4cH3KKOuNp ZVqLJ44JFuPpPIIqsM1O+6QQi9m66qDWIeiI3TMePMRsljbtd6WfQFgeGVSUfLrdNklv96 0BOBIi3YjJz24ib2xVTUE87TVO/RIhx6CAPJxg9r/irdvK4d0bEjSMHGKapJ4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=a11195df34f7b14740447869263d3acf8d72af42 commit a11195df34f7b14740447869263d3acf8d72af42 Author: Jake Freeland AuthorDate: 2022-09-20 17:38:37 +0000 Commit: Emmanuel Vadot CommitDate: 2022-09-20 17:40:05 +0000 linuxkpi: Add strndup_user Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022) --- 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 7a118bb17c48..52110feda6df 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) {