mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
selinux: fix memdup.cocci warnings
Use kmemdup rather than duplicating its implementation
Generated by: scripts/coccinelle/api/memdup.cocci
Fixes: c7c556f1e8
("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>
This commit is contained in:
parent
37ea433c66
commit
879229311b
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user