Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751271AbdFEPaB (ORCPT ); Mon, 5 Jun 2017 11:30:01 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:36374 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751077AbdFEP37 (ORCPT ); Mon, 5 Jun 2017 11:29:59 -0400 MIME-Version: 1.0 In-Reply-To: References: From: Jason Gerecke Date: Mon, 5 Jun 2017 08:29:57 -0700 Message-ID: Subject: Re: [PATCH 1/3] HID: Wacom: Use devm_kcalloc() in two functions To: Jiri Kosina Cc: Linux Input , Benjamin Tissoires , LKML , SF Markus Elfring , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v55FU4bF028288 Content-Length: 2474 Lines: 66 Going through old mail and noticed that these three patches seem to have been overlooked (at least, I don't see them in Jiri's branches...). For the set: Reviewed-by: Jason Gerecke Jason --- Now instead of four in the eights place / you’ve got three, ‘Cause you added one / (That is to say, eight) to the two, / But you can’t take seven from three, / So you look at the sixty-fours.... On Tue, Apr 25, 2017 at 8:13 AM, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 25 Apr 2017 16:06:08 +0200 > > * Multiplications for the size determination of memory allocations > indicated that array data structures should be processed. > Thus use the corresponding function "devm_kcalloc". > > This issue was detected by using the Coccinelle software. > > * Replace the specification of data structures by pointer dereferences > to make the corresponding size determination a bit safer according to > the Linux coding style convention. > > Signed-off-by: Markus Elfring > --- > drivers/hid/wacom_sys.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c > index 0022c0dac88a..550faf8819ea 100644 > --- a/drivers/hid/wacom_sys.c > +++ b/drivers/hid/wacom_sys.c > @@ -1245,7 +1245,7 @@ static int wacom_led_groups_alloc_and_register_one(struct device *dev, > if (!devres_open_group(dev, &wacom->led.groups[group_id], GFP_KERNEL)) > return -ENOMEM; > > - leds = devm_kzalloc(dev, sizeof(struct wacom_led) * count, GFP_KERNEL); > + leds = devm_kcalloc(dev, count, sizeof(*leds), GFP_KERNEL); > if (!leds) { > error = -ENOMEM; > goto err; > @@ -1345,8 +1345,7 @@ static int wacom_led_groups_allocate(struct wacom *wacom, int count) > struct wacom_group_leds *groups; > int error; > > - groups = devm_kzalloc(dev, sizeof(struct wacom_group_leds) * count, > - GFP_KERNEL); > + groups = devm_kcalloc(dev, count, sizeof(*groups), GFP_KERNEL); > if (!groups) > return -ENOMEM; > > -- > 2.12.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-input" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html