From patchwork Tue Feb 7 19:39:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9560951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0360F6047A for ; Tue, 7 Feb 2017 19:41:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA53B28486 for ; Tue, 7 Feb 2017 19:41:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF5BE28488; Tue, 7 Feb 2017 19:41:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A03FA28486 for ; Tue, 7 Feb 2017 19:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755186AbdBGTlK (ORCPT ); Tue, 7 Feb 2017 14:41:10 -0500 Received: from mout.web.de ([217.72.192.78]:52830 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755243AbdBGTke (ORCPT ); Tue, 7 Feb 2017 14:40:34 -0500 Received: from [192.168.1.2] ([78.49.4.3]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MZUJt-1cs2hz3nq9-00LExG; Tue, 07 Feb 2017 20:39:31 +0100 Subject: [PATCH 01/18] HID: Use kmalloc_array() in hid_input_field() To: linux-input@vger.kernel.org, Benjamin Tissoires , =?UTF-8?Q?Bruno_Pr=c3=a9mont?= , Jiri Kosina References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <540faed6-c664-def3-fbf9-767b40444165@users.sourceforge.net> Date: Tue, 7 Feb 2017 20:39:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:Fu+ZekW4AWX9JFg7ZIfR+wvrU6wFbZyb9Qg3Sx10W1YbcebrfDp hn/qsVIgf5u3zk9paTuiB7f+1Va1MQVBxbwl5g29zHDHqZzUNz/pIRZ7mXI1uCeziteVUnK BgKQHb2J4F0gsMmPJ6IQMmIhHcrMAWjKwE+qeOkFZQ4rDzwB8UZia4UgkzJRgWtPCzw7rBb URjPFTBzzwnZtfvPrz/WQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:gnGyIx8DqDM=:nY3319w9NtTSAMep3RomSP I811ZDEYB7HadIIcikvUlZpiiWcgEf+ig8/j1jJ1w8AM0PjCr5REGSMlc69JmEo8EKUvyMCsC aU723nFxmiE8/J+v5DnueCSELKCxAt8bVLD0R3157ts97sEGsd/DYSl5XopUlNgumiqLFEGL+ R/m5qV7xrNKcXCSjpZuKENPgmOE4jwfkiZOAC6unCx+e6sNcWzRjGTFWkk+yMF701dtYGpGZh fA3DSmZgnqIkoleq36pr+cYmjlLWjmewAHCAzu/6+GIBRWS1nSY4jIhzuW7Mb9UU8B1EIYD7K VsfTrorpioomAhanJZYqipBcL+hFoIPEbwHzKOoEcOMcYqstqaSSxphy3GLJNXZ5nWzZs4b7c kATcv0LXfWNLgM9vl5pDdrOKU7a4JYsE4c+7fHgcASbMnaI54Gs5ohgshFnmDYvsoZWs4v0od NRwKoPi/HTJo86MKy7abQ5L3LLgN0ZV+4VG6CLpDqPejz4kuKe4aO9/QN+8NNraZ2HJpnu93T T+OV9WHDg4OYWSF9BvvS7O+VtI7ltk3Tuo12ZBIfjYZk+q0U7WnFk8CTIECjMJ52YEIYZuFl/ 5wJ6xKisfuvykXfIAGFelVoUc47QL70NBTDZMn6b8l1niWVVcJbWPA4wSUrUb/YJwLuy7Mzqb eqezlzzPmZjZyzs+gqdAQDV8bLiC9aa3BgnnX5TUinp02zpm3R4g8jYajtTG4XOS75Mb9GV0r lWymv3KnTmbMYgdPJ+7lj/iotwqwXS7trQJ5g67U/xJ6YXq6RrY/AJeMG7ElEnE12vzpn38gH qXR6OYQ Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 6 Feb 2017 18:18:41 +0100 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 --- drivers/hid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 538ff697a4cf..9b0a97bbde96 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1272,7 +1272,7 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __s32 max = field->logical_maximum; __s32 *value; - value = kmalloc(sizeof(__s32) * count, GFP_ATOMIC); + value = kmalloc_array(count, sizeof(__s32), GFP_ATOMIC); if (!value) return;