diff mbox series

[22/74] backports: add support for kvmemdup

Message ID 20240524190907.896ca9334310.I1558b8083444d6bb053501b489091ab1ac077ae3@changeid (mailing list archive)
State New, archived
Headers show
Series backport updates from Intel | expand

Commit Message

Johannes Berg May 24, 2024, 5:07 p.m. UTC
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>

This was added in 6.3.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/mm.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index 46c7ecafce76..83b495a1bd02 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -10,5 +10,18 @@  static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
 	return kvmalloc_array(n, size, flags | __GFP_ZERO);
 }
 #endif /* < 4.18 */
+#if LINUX_VERSION_IS_LESS(6,3,0)
+
+#define kvmemdup LINUX_BACKPORT(kvmemdup)
+static inline void *kvmemdup(const void *src, size_t len, gfp_t gfp)
+{
+	void *p;
+
+	p = kvmalloc(len, gfp);
+	if (p)
+		memcpy(p, src, len);
+	return p;
+}
+#endif
 
 #endif /* __BACKPORT_MM_H */