mirror of
https://github.com/openvswitch/ovs
synced 2025-09-08 18:25:24 +00:00
23 lines
357 B
C
23 lines
357 B
C
![]() |
#ifndef HAVE_KMEMDUP
|
||
|
|
||
|
#include <linux/slab.h>
|
||
|
#include <linux/string.h>
|
||
|
|
||
|
/**
|
||
|
* kmemdup - duplicate region of memory
|
||
|
*
|
||
|
* @src: memory region to duplicate
|
||
|
* @len: memory region length
|
||
|
* @gfp: GFP mask to use
|
||
|
*/
|
||
|
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;
|
||
|
}
|
||
|
#endif
|