summaryrefslogtreecommitdiff
path: root/lib/linux_compat.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-12-06 16:45:46 -0500
committerTom Rini <trini@konsulko.com>2019-12-06 16:45:46 -0500
commitd79ae6aa3087a6434b5ecdb51d20dca20c8e1596 (patch)
treeef06de49134213591e529ece83d4cec3095e893e /lib/linux_compat.c
parentbead4f2f2c85e1bf39d2c80ef733f1325eb336bb (diff)
parentfb013eee68d08403572ef3c579f6688bbe33fd47 (diff)
Merge branch '2019-12-06-master-imports'
- Allow for the sysboot command, which is used to parse extlinux.conf files to be used without PXE support. There is no functional change here aside from fixing distro boot in a few cases where we actually lacked the ability to parse the extlinux.conf file - Add the x509/pkcs7 parsers from Linux, a pre-requisite to EFI Secure Boot support.
Diffstat (limited to 'lib/linux_compat.c')
-rw-r--r--lib/linux_compat.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/linux_compat.c b/lib/linux_compat.c
index 81ea8fb126f..3f440deaa0d 100644
--- a/lib/linux_compat.c
+++ b/lib/linux_compat.c
@@ -40,3 +40,22 @@ void *kmem_cache_alloc(struct kmem_cache *obj, int flag)
{
return malloc_cache_aligned(obj->sz);
}
+
+/**
+ * kmemdup - duplicate region of memory
+ *
+ * @src: memory region to duplicate
+ * @len: memory region length
+ * @gfp: GFP mask to use
+ *
+ * Return: newly allocated copy of @src or %NULL in case of error
+ */
+void *kmemdup(const void *src, size_t len, gfp_t gfp)
+{
+ void *p;
+
+ p = kmalloc(len, gfp);
+ if (p)
+ memcpy(p, src, len);
+ return p;
+}