The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] selinux: fix memdup.cocci warnings
@ 2020-08-20 10:20 Julia Lawall
  2020-08-20 12:11 ` Stephen Smalley
  2020-08-20 13:28 ` Paul Moore
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2020-08-20 10:20 UTC (permalink / raw)
  To: Stephen Smalley
  Cc: kbuild-all, selinux, Paul Moore, Eric Paris, Ondrej Mosnacek,
	Tom Rix, Ethan Edwards, Wei Yongjun, selinux, linux-kernel

From: kernel test robot <lkp@intel.com>

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>

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git next
head:   37ea433c66070fcef09c6d118492c36299eb72ba
commit: c7c556f1e81bb9e09656ed6650d0c44c84b7c016 [4/6] selinux: refactor changing booleans
:::::: branch date: 4 hours ago
:::::: commit date: 2 days ago

 conditional.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -686,12 +686,11 @@ static int cond_bools_copy(struct hashta
 {
 	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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selinux: fix memdup.cocci warnings
  2020-08-20 10:20 [PATCH] selinux: fix memdup.cocci warnings Julia Lawall
@ 2020-08-20 12:11 ` Stephen Smalley
  2020-08-20 13:28 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2020-08-20 12:11 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kbuild-all, SElinux list, Paul Moore, Eric Paris, Ondrej Mosnacek,
	Tom Rix, Ethan Edwards, Wei Yongjun, linux-kernel

On Thu, Aug 20, 2020 at 6:20 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> From: kernel test robot <lkp@intel.com>
>
> 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selinux: fix memdup.cocci warnings
  2020-08-20 10:20 [PATCH] selinux: fix memdup.cocci warnings Julia Lawall
  2020-08-20 12:11 ` Stephen Smalley
@ 2020-08-20 13:28 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Moore @ 2020-08-20 13:28 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Stephen Smalley, kbuild-all, selinux, Eric Paris, Ondrej Mosnacek,
	Tom Rix, Ethan Edwards, Wei Yongjun, linux-kernel

On Thu, Aug 20, 2020 at 6:20 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> From: kernel test robot <lkp@intel.com>
>
> 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>

Merged into selinux/next, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-20 13:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-20 10:20 [PATCH] selinux: fix memdup.cocci warnings Julia Lawall
2020-08-20 12:11 ` Stephen Smalley
2020-08-20 13:28 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox