From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752689AbdDKRBm (ORCPT ); Tue, 11 Apr 2017 13:01:42 -0400 Received: from mout.web.de ([212.227.17.11]:64316 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751875AbdDKRBh (ORCPT ); Tue, 11 Apr 2017 13:01:37 -0400 Subject: [PATCH 1/2] tty-ehv_bytechan: Use kcalloc() in ehv_bc_init() From: SF Markus Elfring To: Greg Kroah-Hartman , Jiri Slaby Cc: LKML , kernel-janitors@vger.kernel.org References: <4666b729-217c-ab28-4a3c-25ef703054dd@users.sourceforge.net> Message-ID: <8e44e4f8-c6d0-4d7f-97e9-7f9ed62c4bd0@users.sourceforge.net> Date: Tue, 11 Apr 2017 19:01:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <4666b729-217c-ab28-4a3c-25ef703054dd@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:5FJFXxbw8zhQ3Q3oiHlvCG5mlFib47GnFjWG+QdhzzAekTVZApm WLXR0rNWdNxZi5Koq4TPCKPMMwNcInyo0+MP7AIaFWodqp1PWTRa8B9hH/PiYZAKzrpY3x9 NCCa6sFY3jU9v+lqmEe+eZeWHBAS7kA7SSV7W2f2P5deHj89hRoroMMk3i5zuCkEzRQKjN+ Pgm1pxb6VdgJZ8f+r7asA== X-UI-Out-Filterresults: notjunk:1;V01:K0:YjzDR0ih00s=:18hYKqj9+q8kHFxSA1yB6w 5jzk0R1i6VD/fJIHaWzL0wc5dGQHnfMeHXomXBtEU23W9/xyWYmp7Z5AtcrsR8ooP+qGbGRKX w7hfS2Pb1YrUJ86vwC/Q676csJfoWLd49MkR04k1FftlQ5PJWauVwMRVQ9S710uuVYGKjo445 CCsfqvncqB+ZRA/Ko7AoFbDVlxehKZ/jhA8gSpF4pnvt3kn/gSkkB/yv04qznFKCxhDpsTSyA Ky1m7cPPkkobdHB+bXyvoP30Df6CxJ/o68NnZBAFKICIjyLJssLw50B1tHMozl6mpuEWlhPDa yGS0XstQgUPSFtOtV97G2THV9iajORRg/Uc+XiwYVl9+4HKt93mqVsaOQH6oxcpm5gysGALBd cHamjbVou4wgdI1XFXe0QT53//Hp9TBUwFf0GSNP+JPmUVlpGGqW3Fykte5Uke3nz2n8z25QA w403A80/c8RpLOiSNQngtG15GBpRPd7TJJHVOrGGZon9ttlJqt4w01hieewft/SJ8bbRMgYaM uDMbT6HjMDfNwfdbxtSwNKWXF1y6vmePrRnQUKgRMvPTEB0ABwaU2MrptpY90qVWlaQG8sPrb GqohXEZXnFOWAykwRtdsZipWCoQiA+Knful7r5WA5QlWQdYZi1ePR3qebJalHukPqONxeoecn PQmaynIdV2ko2iDGnKHNBaMkQzI+mi5U8f2rLGfsZ/TGJ8VxjwFF5PdefbM1oIH/vsa4I8c26 qFSiz7A7cDpWrSafOwb5Dr18rDLKxEK3IF/H1VjPEnBOCLsf1UIIEftqjIzxRWHow1i5QquAx 889sYJi Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Tue, 11 Apr 2017 18:24:42 +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 structure 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/tty/ehv_bytechan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index 7ac9bcdf1e61..e17b7c765466 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c @@ -757,7 +757,7 @@ static int __init ehv_bc_init(void) * array, then you can use pointer math (e.g. "bc - bcs") to get its * tty index. */ - bcs = kzalloc(count * sizeof(struct ehv_bc_data), GFP_KERNEL); + bcs = kcalloc(count, sizeof(*bcs), GFP_KERNEL); if (!bcs) return -ENOMEM; -- 2.12.2