From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756142AbcIMUqq (ORCPT ); Tue, 13 Sep 2016 16:46:46 -0400 Received: from mout.web.de ([217.72.192.78]:56625 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbcIMUqp (ORCPT ); Tue, 13 Sep 2016 16:46:45 -0400 Subject: [PATCH 4/7] AGPGART-SGI: Use kmalloc_array() in agp_sgi_init() To: kernel-janitors@vger.kernel.org, David Airlie References: <566ABCD9.1060404@users.sourceforge.net> <5204ca92-2cdf-8115-567c-4ac29816fcec@users.sourceforge.net> Cc: LKML , Julia Lawall From: SF Markus Elfring Message-ID: <1fbcb4e9-7927-466a-92d4-d554d095dddb@users.sourceforge.net> Date: Tue, 13 Sep 2016 22:46:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <5204ca92-2cdf-8115-567c-4ac29816fcec@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:bCrnWOMcHk3QP1PGyt5PDt5IMChz/5XfDdmTGjP1Q9KeQyfKyWW P+1pC47dQ1OY44q8AiCoOV0s7CXykgJF92p9tVXZn/tQcgwA+SUy1vKurS4ekrfWlevh4bG zJgyb4CzMWSfNavmAtYKFyLXHX2rK0/0PEh4O3FPufg5TIUhchaXYEymdC6qM+FGR2JPvv8 PBYJBc8yAAuxVBzcnbRlw== X-UI-Out-Filterresults: notjunk:1;V01:K0:7l0mTi/btq0=:l6piCSCEoCOryLoa8jR76I qzh2Vte+TzrTgtaohvTFJS/A1YwYVTxmbpR8EiMrzLAWHouLfsgbpT/QO6pjlBMbZG001sNes pwDTxBzKhQC7R4+ArqcmyKHbcZy9BHqcFO5EJpVEBh/59gOHtpan/GvWcoyQGxhtg8GKPh9lG blhBNdGBVPV0MnatHY/8SCxfIRZWsbw0m4F4aR+IBomxzbHR2h+2rOkWilzrYuR9q0j4vCBxF xCyqUv357gLEMkD77nCZfM13mX+1UkeMi1Ue7oM+aBTwbGAYfgj6676noDy9h2tYiwyL9Fb/w ZQV1qe6m/6hEGLbWARlUIoR4GHIhBqpsp+N4uuzHGWYyuDhAZ695vjRjjrP4WeAPT+oz2MBS3 4z4cq3cZU2LvraEBE0RpGq/s8BJuvjSpvgYdTzH8iNY7i7p7uCjr+8rW2ogWQ1aYX8kC+9LA/ h7420tHi6BOOwca2EZu3sQj9q004oeSgVKZK031eOe2Kt8UIr1e4zHVV2iOKRj1DJ2HSapylA ruhenQgSHg9KRL8Td6Djle716CG4+Ev5MJcSjzNSPWrS4FA5mDaADlcU6RmdLegeTSUKIcsuL Dvgvjab2UTa5bnta9L63JlZY3sOrxInRdijbyNufY+yYUu7Kg2KEKbmPb9Eg1jIAt7jQWH51H ZhfzinBDCfRYJE4n0c1Z8OtUUXXpfUrPAH5+mgstNtgmrDqbmHPLHyGyAvCOKnomusHriENV9 EQ1KaKftS4b6OSH+WXJVJPpfvwl/s+7Nxj5ZgVKGbeLbLLs47//vyUB5BcALwxh3oUis9uJKa STMHlYu Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 13 Sep 2016 21:30:58 +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 "kmalloc_array". 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 --- drivers/char/agp/sgi-agp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c index 3051c73..798ad20 100644 --- a/drivers/char/agp/sgi-agp.c +++ b/drivers/char/agp/sgi-agp.c @@ -280,9 +280,9 @@ static int agp_sgi_init(void) else return 0; - sgi_tioca_agp_bridges = kmalloc(tioca_gart_found * - sizeof(struct agp_bridge_data *), - GFP_KERNEL); + sgi_tioca_agp_bridges = kmalloc_array(tioca_gart_found, + sizeof(*sgi_tioca_agp_bridges), + GFP_KERNEL); if (!sgi_tioca_agp_bridges) return -ENOMEM; -- 2.10.0