[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20c641bb-33af-39ec-9208-cbc560441223@users.sourceforge.net>
Date: Sat, 20 May 2017 21:14:45 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: Arnd Bergmann <arnd@...db.de>, Jan Kara <jack@...e.cz>,
Jesper Nilsson <jesper.nilsson@...s.com>,
Kumar Gala <galak@...nel.crashing.org>,
Lorenzo Stoakes <lstoakes@...il.com>,
Michal Hocko <mhocko@...e.com>,
Timur Tabi <timur@...escale.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 4/5] fsl_hypervisor: Use kcalloc() in ioctl_memcpy()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 20 May 2017 20:15:57 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data type by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/virt/fsl_hypervisor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 9e881dc29c6b..4031632b8c9d 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -223,5 +223,5 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
* 'pages' is an array of struct page pointers that's initialized by
* get_user_pages().
*/
- pages = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
+ pages = kcalloc(num_pages, sizeof(*pages), GFP_KERNEL);
if (!pages) {
--
2.13.0
Powered by blists - more mailing lists