From nobody Wed Jun 12 16:41:17 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 4VzrsB41SFz5N362; Wed, 12 Jun 2024 16:41:18 +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 4Vzrs93yDwz4gfr; Wed, 12 Jun 2024 16:41:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718210477; 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=5FC1P5Re2ZAf2WUTVqwvzmVoZHRPOSh4NimPprvWNKE=; b=sumkLlHhs/cqcqYyAR2ldvfCTfSexsOLOmbmYjozbP5P89BNE24shKJ2i1u9dYTBOxC83L 6uGNk1se7bltELzWKz7E9/XZ1yq3mcokjmR+esHPQ6+EEbILHgOhaToNQrfvmaZTdPhMkE +b3Ek6meJKI+1Z4G6uGrriIRGmQjqTI4duMgO7cNDH9MY28xUQhDSNE9x2fP4G0meyRrVC LeH2YiEx9/sstJ/aFj2SH1sq+GqwjCUmO4l9t6q5TzZNE/6so9xlxl+mI5n6v6Q2qS5XdR 3l6CJtqhqmFo2LsF61DCvSJPOcYrhrJekcZl+DBWPxFAtP3Lw68jvAsL2b4x5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718210477; a=rsa-sha256; cv=none; b=WE2YuKzLj3qJawhfy1gO4UdDIz9CP9Ej+WBDJ9tZERnZ29O6HLRTaFpzuLcBVwp3am8QsY Jea72ASnlPlEdwoMMOfU8b6bknmFZGCHGYxdZs3yzCv6AN8jacon2DY9t5ZM/touWlA8xn LnYnK8fK3kGMgmc5SpbP1ek94rDfbZy6c299F57s0D8aahgXWmwcEzQbsvr3hXr5oXa8AP d4qzZ8DTyKt8U5vDlbT3Fn1QM4oiY2jKWlQ7CGPZ779iirFcCw1lxJ16bpYVO5jMNankG7 x3rXnb/IarQ72S91ox5867FwnR+dTeoOomNDv2VQWPJlEvn/3oOd2fHKfXyPKA== 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=1718210477; 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=5FC1P5Re2ZAf2WUTVqwvzmVoZHRPOSh4NimPprvWNKE=; b=wd6dNnAVep/0B4tgS++ardALAAsjmfvtkJwRuY01DsRMF0P2KhBPhgT6z1QzcKQJoC/E+o 3qP4mtbCb55ljSxgXhd0ilaf+6oGtD4BaS3tTx0HI/8CFuAul500cry7U0kMr6UwXIK1v4 DuvjcC5Wjq+9tRvmYF1Vo4bQzTQ3g1sp/he2t0i7PCEWPB4+QUWu0ZoPC68MDZENvowqVl dMftu1cCPmU3+7EuEHngBQYYemDAqS1rcERGuIXNU/J9YacQfRbY0+ss7zGE8XIX0mxDac zo6biKY13BMXqAZaPeuusdWG28LMyu4Y88SJgcWzo5DQyXraimH4Sf7kCI08Tw== 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 4Vzrs92gtcz112r; Wed, 12 Jun 2024 16:41:17 +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 45CGfHmp046437; Wed, 12 Jun 2024 16:41:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45CGfHDj046434; Wed, 12 Jun 2024 16:41:17 GMT (envelope-from git) Date: Wed, 12 Jun 2024 16:41:17 GMT Message-Id: <202406121641.45CGfHDj046434@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: a87e584f6c9d - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: a87e584f6c9d1fbe6bb47e588628aae4331c9967 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a87e584f6c9d1fbe6bb47e588628aae4331c9967 commit a87e584f6c9d1fbe6bb47e588628aae4331c9967 Author: Bjoern A. Zeeb AuthorDate: 2024-05-13 17:43:25 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-12 13:57:24 +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) {