From nobody Wed Mar 23 13:39:00 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 4F67A1A2AB08; Wed, 23 Mar 2022 13:39:01 +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 4KNqFd1WgSz4TZR; Wed, 23 Mar 2022 13:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648042741; 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=wW+0CChUIDr+GZbXSkLrqiFPrL0bV+pTvq1UAlVStMk=; b=SbbGsJInd9b20w3LJ0JpHNORe5ryrVRAYOke6tvvYX9jwGsVcaDXLqNocZPz9NjsVTqluJ sio1lFcmi4IPlkFL35Wb8Htk7qt0XIGXJmrj0KQGyOfDNHUUF8ODyWl0AQ+PZOHc2UoVmC shq5WLLGbO7KKpgudk49UPU0Yy0KFYbFx7cPd/9LR16bBHTNaw2hXctWml0hPZJnNUTwBH 1zjLadcWE1yliRYqKTO8AGPWf5CnrnavP4hwoyy93NxrLETNVQ4LrmFPnlxzrAoizPNiTD +VhsXZA1DfrODw6ealnPmmzMorLzVjJp2qLEmy7M1k72ItwsZnUD/6oDVfdebA== 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 0D2EB23FF2; Wed, 23 Mar 2022 13:39:01 +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 22NDd0t1006976; Wed, 23 Mar 2022 13:39:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22NDd0Xq006975; Wed, 23 Mar 2022 13:39:00 GMT (envelope-from git) Date: Wed, 23 Mar 2022 13:39:00 GMT Message-Id: <202203231339.22NDd0Xq006975@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: 8e587a5f13ce - main - linuxkpi: Add kstrtouint_from_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: 8e587a5f13ce676d7763ffa920148fe31bc3bfae Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648042741; 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=wW+0CChUIDr+GZbXSkLrqiFPrL0bV+pTvq1UAlVStMk=; b=Z1GkhDd1DlQeGflRtDae4c1Kq6sBd9jRPdcD5jlz9wCJWH1tr3lQimsjIOEyO5OoMn8U1j ytBISp5QZdjkvchUnUWYgEqJd0o/K+KUEliW7zsXk4uksewD8sbRkIUuDOFHbwRQxQSUx9 qou072yCFzJ/y/ayMZa3jlOle+lsDg42bvAgGqeugzzTB5SH6NdDVPygC/YEKwVWlHypoa LcGA0Jj7t1JNlbAoIrSM/RWRsnfWyJbwBCU/LcQOs6g4+sZaxcLJW9zKkprQAawUhVvHNp bIHnxq+Ll6Qu2NPXPD3KKndmhUUUaNxQmFUJodfQrEBCss/iC92fMEMtZ9sn8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648042741; a=rsa-sha256; cv=none; b=qaVP8+RikBkDy4z3UfUmkW68UddYfhVpur/V+U6y50VhQ3/OQwg+zb+Bo5nTVcdByoX6Qy 3HQu/kLai4Bb6cb4LgXpyX7AKm3I0gvCA4dlN4TsdhGmTs+PYZ5BnCH/3GOru14L06ckKC +XTLut+BCXrErINbZNbIGh/QRS4DfvhgfT8uZLrxX+KiOZc/tMJzmF+2g7hSFPvEHnmRht GfxfeVqmhlhezLEW3ZGQmWY7ArEiEt2aEiK8NAfOb3dFP7JTkGf4ngB3g50RaMyS7/Oj7E t1wT2m8IJEkNv3s90grDN/2pDYozB21en1GgeVkeETpO1kPPayXmktBXqXFkFw== 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=8e587a5f13ce676d7763ffa920148fe31bc3bfae commit 8e587a5f13ce676d7763ffa920148fe31bc3bfae Author: Emmanuel Vadot AuthorDate: 2022-03-22 09:22:42 +0000 Commit: Emmanuel Vadot CommitDate: 2022-03-23 13:37:32 +0000 linuxkpi: Add kstrtouint_from_user Like kstrtoint_from_user but for uint. Needed by drm v5.10 MFC after: 1 month Reviewed by: hselasky Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D34642 --- sys/compat/linuxkpi/common/include/linux/kernel.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index d6916812f02a..8fb92dd2f93e 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -524,6 +524,21 @@ kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, return (kstrtoint(buf, base, p)); } +static inline int +kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, + int *p) +{ + char buf[36] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtouint(buf, base, p)); +} + static inline int kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *p)