From: Julia Lawall <julia.lawall@inria.fr>
To: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: kbuild-all@lists.01.org, selinux@vger.kernel.org,
Paul Moore <paul@paul-moore.com>,
Eric Paris <eparis@parisplace.org>,
Ondrej Mosnacek <omosnace@redhat.com>, Tom Rix <trix@redhat.com>,
Ethan Edwards <ethancarteredwards@gmail.com>,
Wei Yongjun <weiyongjun1@huawei.com>,
selinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selinux: fix memdup.cocci warnings
Date: Thu, 20 Aug 2020 12:20:51 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2008201218350.2524@hadrien> (raw)
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;
next reply other threads:[~2020-08-20 10:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 10:20 Julia Lawall [this message]
2020-08-20 12:11 ` [PATCH] selinux: fix memdup.cocci warnings Stephen Smalley
2020-08-20 13:28 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2008201218350.2524@hadrien \
--to=julia.lawall@inria.fr \
--cc=eparis@parisplace.org \
--cc=ethancarteredwards@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
--cc=trix@redhat.com \
--cc=weiyongjun1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox