Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d1db4b2 authored by Duan Jiong's avatar Duan Jiong Committed by Paul Moore
Browse files

selinux: Use kmemdup instead of kmalloc + memcpy

parent 7a362838
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -268,10 +268,10 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
	if (!old_ctx)
		return 0;

	new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len, GFP_ATOMIC);
	new_ctx = kmemdup(old_ctx, sizeof(*old_ctx) + old_ctx->ctx_len,
			  GFP_ATOMIC);
	if (!new_ctx)
		return -ENOMEM;
	memcpy(new_ctx, old_ctx, sizeof(*old_ctx) + old_ctx->ctx_len);
	atomic_inc(&selinux_xfrm_refcount);
	*new_ctxp = new_ctx;