提交 7d1db4b2 编写于 作者: D Duan Jiong 提交者: Paul Moore

selinux: Use kmemdup instead of kmalloc + memcpy

Signed-off-by: NDuan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: NPaul Moore <paul@paul-moore.com>
上级 7a362838
...@@ -268,10 +268,10 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, ...@@ -268,10 +268,10 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
if (!old_ctx) if (!old_ctx)
return 0; 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) if (!new_ctx)
return -ENOMEM; return -ENOMEM;
memcpy(new_ctx, old_ctx, sizeof(*old_ctx) + old_ctx->ctx_len);
atomic_inc(&selinux_xfrm_refcount); atomic_inc(&selinux_xfrm_refcount);
*new_ctxp = new_ctx; *new_ctxp = new_ctx;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册