lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5243A058.2090104@cn.fujitsu.com>
Date:	Thu, 26 Sep 2013 10:47:52 +0800
From:	Duan Jiong <duanj.fnst@...fujitsu.com>
To:	sds@...ho.nsa.gov, james.l.morris@...cle.com, eparis@...isplace.org
CC:	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] selinux: Use kmemdup instead of kmalloc + memcpy



Signed-off-by: Duan Jiong <duanj.fnst@...fujitsu.com>
---
 security/selinux/xfrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index 425b9f9..5c809c1 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -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;
 
-- 
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ