From: Markus Elfring Date: Sun, 15 Jan 2017 12:13:19 +0000 (+0100) Subject: selinux: Use kmalloc_array() in sidtab_init() X-Git-Tag: v4.14-rc2~6^2~112^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b380f783772eeb66a0da85549a85aadbe5f8e76d;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: Paul Moore --- diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c index 5840a35..c9533b2 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++)