git: f1834d03af61 - main - LinuxKPI: implement devm_kmemdup_array()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Apr 2026 01:12:59 UTC
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=f1834d03af617a93993056bb902082452673f89f
commit f1834d03af617a93993056bb902082452673f89f
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-04-14 13:35:36 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-04-18 01:12:14 +0000
LinuxKPI: implement devm_kmemdup_array()
Implement devm_kmemdup_array() using devm_kmemdup() in order to
prepare for Linux v7.0 based drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D56396
---
sys/compat/linuxkpi/common/include/linux/device.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index 8834f1799e61..030e9b127540 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -701,6 +701,13 @@ devm_kmemdup(struct device *dev, const void *src, size_t len, gfp_t gfp)
return (dst);
}
+static inline void *
+devm_kmemdup_array(struct device *dev, const void *src, size_t n, size_t len,
+ gfp_t gfp)
+{
+ return (devm_kmemdup(dev, src, size_mul(n, len), gfp));
+}
+
#define devm_kzalloc(_dev, _size, _gfp) \
devm_kmalloc((_dev), (_size), (_gfp) | __GFP_ZERO)