Commit 87922931 authored by kernel test robot's avatar kernel test robot Committed by Paul Moore
Browse files

selinux: fix memdup.cocci warnings



Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: c7c556f1 ("selinux: refactor changing booleans")
CC: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarJulia Lawall <julia.lawall@inria.fr>
Acked-by: default avatarStephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 37ea433c
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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;