From nobody Tue May 21 22:15:26 2024 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 4VkTJt3mKrz5KhL2; Tue, 21 May 2024 22:15:26 +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 4VkTJt2v0Fz4VHf; Tue, 21 May 2024 22:15:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716329726; 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=UdkTYktb04dm3lIPPKdAFyDDRRcw+r/HAPBFh2vltpQ=; b=alGVFpeZoDhUPkOx3fZVmxX6fD8jjaNd4TvKccXkcKSfVqUBFn2TXEgeDgiLoEtvmOH4v6 aCnP9fKbt/FbpFdiW4ypNgpFgthZdaH9hr6n6jHPGlxH2vFBJyVVZUy3rT0Y6u0m8lzBq7 /CbavQU7ujnQt7M4NjJ/9N31e77snsGsPRt3dL0AE7rBWGSu/RT7mklgNT0MQ2klsRgEMw 6RnDpEqx0hwe3lF/v4XkleFhbV3T3vVNPgnrAPkKaaMEPJcTxixCra2Pk4D0P+1IREenDZ qvlhytlF8oS2GysaB43xH+yhPTlEC0CCoJRqx9HAmIkXHyvov2jV3ZdzklDNow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716329726; a=rsa-sha256; cv=none; b=OCnlp9YLpY2SJlEopmfH0ZphLtmXfgK28f8eXFVgusBGbyZdw8G/o54mSOtRCDwThyeroO kQyhzWi3C1/1dT4OgI2i2KcvLgfX2zDS1DTv+B3HmfJX2W6axVnYAYOF963EIK6McR6vVb ThTUdStcpluUxjpvTsQYvQNe0XipaVfYj0N2Cb6ItBqMZcqeEAYi9GsA5bSqoYkUpYFsfB aIJE4ZoDcOwScbcmC4AnYMRmxiiFdfqjUg05KBDAQIdMEfqpUm2ArdTk565nq/j73XIAA7 OzG5CD0eY8cJKag5tcXjg7uuckFCETAmCQRsYg3R68vdn0owkMz5hCEm6eFL0A== 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=1716329726; 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=UdkTYktb04dm3lIPPKdAFyDDRRcw+r/HAPBFh2vltpQ=; b=e/AnIBiwUiSckc5cTNeOGkIxzw8l+W7ecQwFRXkSuJDcNcoypFQ0IKz9d4Y7zydjBC9yRU 1TPFcpqkActAG1B9e1cSINDN+VWSSaC6+T5xhTdI4QliEV43eO08RlNzPwg0Gkwf9n31gu bMcW1Xeesnb3htwEj6Ed8O02XlopgZwZRIDlwpFD3NIraNqVxaC5WXYpbpAGEcs0LsZOdO bYtyGoj7VR4y1ZoqKwuUveW2osNFb4dW2eHWiEiOlJCVxiweCtbxFGZ3FiFNqV0lK8FUVa eKITCRXdiUUqu8BRICMbUraKPYZVyFY22B91cYvsJGqxfESrNj6FszlFUM0IzA== 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 4VkTJt2VRszg0T; Tue, 21 May 2024 22:15:26 +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 44LMFQSx062072; Tue, 21 May 2024 22:15:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44LMFQqs062069; Tue, 21 May 2024 22:15:26 GMT (envelope-from git) Date: Tue, 21 May 2024 22:15:26 GMT Message-Id: <202405212215.44LMFQqs062069@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8e4b8e9d807a - main - LinuxKPI: add kvmemdup() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e4b8e9d807aa379d2a1c3aaac2537ba7d6bf0bf Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8e4b8e9d807aa379d2a1c3aaac2537ba7d6bf0bf commit 8e4b8e9d807aa379d2a1c3aaac2537ba7d6bf0bf Author: Bjoern A. Zeeb AuthorDate: 2024-05-13 17:43:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-05-21 22:14:50 +0000 LinuxKPI: add kvmemdup() Add kvmemdup() as a variant of kmemdup(). While currently it could just call kmemdup() we duplicate the code and use kvmalloc() in case someone will change the implementation of kvmalloc/kvfree in slab.h. This is used by an updated wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D45181 --- sys/compat/linuxkpi/common/include/linux/string.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index 9e1818a38594..32470312b78b 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -98,6 +98,18 @@ kmemdup(const void *src, size_t len, gfp_t gfp) return (dst); } +/* See slab.h for kvmalloc/kvfree(). */ +static inline void * +kvmemdup(const void *src, size_t len, gfp_t gfp) +{ + void *dst; + + dst = kvmalloc(len, gfp); + if (dst != NULL) + memcpy(dst, src, len); + return (dst); +} + static inline char * strndup_user(const char __user *ustr, long n) {