summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkernel test robot <lkp@intel.com>2020-08-20 12:20:51 +0200
committerPaul Moore <paul@paul-moore.com>2020-08-20 08:39:05 -0400
commit879229311bc8a887f00d827525ea59f23861c1ad (patch)
tree2679b83d99e3d396cacae0be06284d61e178e12a
parent37ea433c66070fcef09c6d118492c36299eb72ba (diff)
downloadlinux-879229311bc8a887f00d827525ea59f23861c1ad.tar.gz
linux-879229311bc8a887f00d827525ea59f23861c1ad.tar.bz2
linux-879229311bc8a887f00d827525ea59f23861c1ad.zip
selinux: fix memdup.cocci warnings
Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: c7c556f1e81b ("selinux: refactor changing booleans") CC: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: kernel test robot <lkp@intel.com> Signed-off-by: Julia Lawall <julia.lawall@inria.fr> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--security/selinux/ss/conditional.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index 05c7a10e0aab..0b32f3ab025e 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -686,12 +686,11 @@ static int cond_bools_copy(struct hashtab_node *new, struct hashtab_node *orig,
{
struct cond_bool_datum *datum;
- datum = kmalloc(sizeof(struct cond_bool_datum), GFP_KERNEL);
+ datum = kmemdup(orig->datum, sizeof(struct cond_bool_datum),
+ GFP_KERNEL);
if (!datum)
return -ENOMEM;
- memcpy(datum, orig->datum, sizeof(struct cond_bool_datum));
-
new->key = orig->key; /* No need to copy, never modified */
new->datum = datum;
return 0;