From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH 01/10] dm snapshot: Use kmalloc_array() in init_origin_hash() Date: Thu, 29 Sep 2016 03:02:56 -0700 Message-ID: <1475143376.1946.2.camel@perches.com> References: <566ABCD9.1060404@users.sourceforge.net> <080668d9-1e1e-e208-f9ea-ff718e8070e5@users.sourceforge.net> <3861d349-48fd-162b-a749-83e007f70b41@users.sourceforge.net> <1475142864.31297.5.camel@tiscali.nl> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <1475142864.31297.5.camel@tiscali.nl> Sender: linux-kernel-owner@vger.kernel.org To: Paul Bolle , Andy Whitcroft Cc: SF Markus Elfring , dm-devel@redhat.com, linux-raid@vger.kernel.org, Alasdair Kergon , Mike Snitzer , Shaohua Li , LKML , kernel-janitors@vger.kernel.org, Julia Lawall List-Id: linux-raid.ids On Thu, 2016-09-29 at 11:54 +0200, Paul Bolle wrote: > Andy, Joe, > > On Thu, 2016-09-29 at 11:07 +0200, SF Markus Elfring wrote: > > * Multiplications for the size determination of memory allocations > >   indicated that array data structures should be processed. > >   Thus use the corresponding function "kmalloc_array". > > > >   This issue was detected by using the Coccinelle software. > > > We have no hope of fixing Markus' homegrown coccinelle script. But we > could try to fix the checkpatch false positive here. What's the false positive? I get: $ ./scripts/checkpatch.pl -f drivers/md/dm-snap.c --show-types --types=alloc_with_multiply WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply #329: FILE: drivers/md/dm-snap.c:329: + _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), WARNING:ALLOC_WITH_MULTIPLY: Prefer kmalloc_array over kmalloc with multiply #338: FILE: drivers/md/dm-snap.c:338: + _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), total: 0 errors, 2 warnings, 2490 lines checked NOTE: For some of the reported defects, checkpatch may be able to       mechanically convert to the typical style using --fix or --fix-inplace. drivers/md/dm-snap.c has style problems, please review. NOTE: Used message types: ALLOC_WITH_MULTIPLY NOTE: If any of the errors are false positives, please report       them to the maintainer, see CHECKPATCH in MAINTAINERS.