summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-01-15 13:13:19 +0100
committerPaul Moore <paul@paul-moore.com>2017-03-29 11:44:10 -0400
commitb380f783772eeb66a0da85549a85aadbe5f8e76d (patch)
tree99944fceb5c371cf919a4f8ec83ad99c5b95bb92 /security
parentebd2b47ba52760e9653456ba19032f79d734a343 (diff)
downloadlinux-b380f783772eeb66a0da85549a85aadbe5f8e76d.tar.gz
linux-b380f783772eeb66a0da85549a85aadbe5f8e76d.tar.bz2
linux-b380f783772eeb66a0da85549a85aadbe5f8e76d.zip
selinux: Use kmalloc_array() in sidtab_init()
A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/sidtab.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
index 5840a35155fc..c9533b21942b 100644
--- a/security/selinux/ss/sidtab.c
+++ b/security/selinux/ss/sidtab.c
@@ -18,7 +18,7 @@ int sidtab_init(struct sidtab *s)
{
int i;
- s->htable = kmalloc(sizeof(*(s->htable)) * SIDTAB_SIZE, GFP_ATOMIC);
+ s->htable = kmalloc_array(SIDTAB_SIZE, sizeof(*s->htable), GFP_ATOMIC);
if (!s->htable)
return -ENOMEM;
for (i = 0; i < SIDTAB_SIZE; i++)