From nobody Wed Jun 12 19:16:48 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 4VzwJc5NCPz5NHhg; Wed, 12 Jun 2024 19:16:48 +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 4VzwJc4VNsz56gZ; Wed, 12 Jun 2024 19:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718219808; 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=tUAy4bc5fDl5vUXmhMFDnbW9ZWpjOeMCmVyYi1Ee5wI=; b=wb6mmkaFJ/tqENur3GFCUqZN0bG0/QrLBHcgW5zCmlIrBf/lEFlbOmzQnQtLnCIgrovjrP yrNA7wtAxmLGJoWPqTsHEN4UOrv5tCD6dWVC1LdwMQjI3E6O8GBcJ/IKz6NZonycsgkTiK M51gUXimD+geTuObKOu2wJ1wuIrKSgpT0QoKqpZXIA0PeCaJVLYFYZ0I015jAcyRkZYz1f celFdKz6cHwRnOQphel9UWQse8lfNC7II/UiiCgZ6KQE+TWdLB2M/QTc1C4HA19JL8XWcJ A8P/6wInIgxXQMGMqwCGQ+sCvzKPBsawTqLy6iFwn2Bvd7p26KKD0r0Zt70Ksw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718219808; a=rsa-sha256; cv=none; b=JcQHNDxuUCkHePDrjx1WIbWkdUMqmTahuWCbKfpsU3sZ25iCTK3ObvfKzB8Ml2o6kvH0c+ KumSn3blSXLll3JIbxNGxunCGsOVUqutaBzzbQeL6pRVMRELE9lsYagx1kT5QK9Usr71mw 0RWuIjBrUnqJsPn1M01mCUnRS6uAFiRZFHV8oVOtCuxKVrj3hitbgL7COvhdzLdKqqKPWQ pWt4a0gnJIjTqRskmFO9GBuXwC8FjNiZrJ/9EM8emQAd2LLUiDZJo1rGyhKfSAS8RYaG65 BNHu+E5ylIZQSZFEyO1d/KG6wMQLsWBsxUKm2w8CRZ3tbUshGJQJmJ6nCHLjCA== 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=1718219808; 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=tUAy4bc5fDl5vUXmhMFDnbW9ZWpjOeMCmVyYi1Ee5wI=; b=aR2FXBoTjfY0SBZvHkJXujXvCx0gaFl+QvatsCItpAed34Vo0nxKWXtpzsS2MupQ4vGg+C uaiUnGBhYnrI1bk331B8egg2WBDpNNIyqbZAe7GKwDCBopUp54CdAt6rS6Ml8/SV045Q1N zIcZ/fN1e9m/8cfX1zbVdw56C8Lq6xa1mfjddSd/KSR3jw68TJ7X0G93wzCUl5fE8NPZsP f9fmardGmH4WW9hE6FJIEEBR8tPrWPwJ40+k/yi8mgHi7KIdqJiLpAQWC+yx+NO8qzJdcr tX98j7+uixATJ85+1FBejsAHvOjc4e4JdMypgG5UHj5ONnNIeqi/tkQqWSyxjw== 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 4VzwJc458pz14Tq; Wed, 12 Jun 2024 19:16:48 +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 45CJGmYK004028; Wed, 12 Jun 2024 19:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45CJGmwx004025; Wed, 12 Jun 2024 19:16:48 GMT (envelope-from git) Date: Wed, 12 Jun 2024 19:16:48 GMT Message-Id: <202406121916.45CJGmwx004025@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 395833f4ea8f - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 395833f4ea8f4852f47ca1473baf99239331379e Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=395833f4ea8f4852f47ca1473baf99239331379e commit 395833f4ea8f4852f47ca1473baf99239331379e Author: Bjoern A. Zeeb AuthorDate: 2024-05-13 17:43:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-12 16:57:56 +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 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D45181 (cherry picked from commit 8e4b8e9d807aa379d2a1c3aaac2537ba7d6bf0bf) --- 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 06dcdbd97663..9302c95e8636 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -97,6 +97,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) {