Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933252AbcJMQdU (ORCPT ); Thu, 13 Oct 2016 12:33:20 -0400 Received: from smtprelay0196.hostedemail.com ([216.40.44.196]:47127 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756959AbcJMQbF (ORCPT ); Thu, 13 Oct 2016 12:31:05 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1714:1730:1747:1777:1792:2393:2559:2562:2828:2899:3138:3139:3140:3141:3142:3350:3622:3868:4321:5007:6691:7903:10004:10400:10848:11026:11473:11658:11914:12043:12048:12294:12438:12740:12760:13069:13311:13357:13439:14659:14721:21080:21212:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: angle66_1a18536bf122b X-Filterd-Recvd-Size: 1826 Message-ID: <1476376177.2164.10.camel@perches.com> Subject: Re: [PATCH 01/18] [media] RedRat3: Use kcalloc() in two functions From: Joe Perches To: SF Markus Elfring , linux-media@vger.kernel.org, Hans Verkuil , Mauro Carvalho Chehab , Sean Young , Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall Date: Thu, 13 Oct 2016 09:29:37 -0700 In-Reply-To: <21c57b39-25ac-2df1-030d-11c243a11ebc@users.sourceforge.net> References: <566ABCD9.1060404@users.sourceforge.net> <81cef537-4ad0-3a74-8bde-94707dcd03f4@users.sourceforge.net> <21c57b39-25ac-2df1-030d-11c243a11ebc@users.sourceforge.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.0-2ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 666 Lines: 17 On Thu, 2016-10-13 at 18:18 +0200, SF Markus Elfring wrote: > diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c [] > @@ -549,7 +549,7 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) > int rc = 0; > char *buffer; > > - buffer = kzalloc(sizeof(char) * (RR3_FW_VERSION_LEN + 1), GFP_KERNEL); > + buffer = kcalloc(RR3_FW_VERSION_LEN + 1, sizeof(*buffer), GFP_KERNEL); > if (!buffer) { > dev_err(rr3->dev, "Memory allocation failure\n"); > return;, Markus, please stop being _so_ mechanical and use your brain a little too. By definition, sizeof(char) == 1. This _really_ should be kzalloc(RR3_FW_VERSION_LEN + 1,...)