From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752698AbbFSAYM (ORCPT ); Thu, 18 Jun 2015 20:24:12 -0400 Received: from smtprelay0041.hostedemail.com ([216.40.44.41]:55641 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752193AbbFSAYH (ORCPT ); Thu, 18 Jun 2015 20:24:07 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:966:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3871:3872:3873:3874:4250:4321:4385:5007:6119:6261:7901:7903:10004:10400:10848:11232:11658:11914:12043:12296:12517:12519:12740:13069:13311:13357:21080,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 X-HE-Tag: voice18_40af98b9a790e X-Filterd-Recvd-Size: 1886 Message-ID: <1434673443.2689.115.camel@perches.com> Subject: Re: [PATCH] staging: wlan-ng: Fix memset warning found by sparse From: Joe Perches To: Greg KH Cc: Bilel DRIRA , eng.douglasfigueiredo@gmail.com, matt@ninezulu.com, josh@joshtriplett.org, raghav3276@gmail.com, tapaswenipathak@gmail.com, artemiyv@acm.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Thu, 18 Jun 2015 17:24:03 -0700 In-Reply-To: <20150618230407.GD32238@kroah.com> References: <1434649791-4730-1-git-send-email-bilel.dr@gmail.com> <20150618230407.GD32238@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 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 On Thu, 2015-06-18 at 16:04 -0700, Greg KH wrote: > On Thu, Jun 18, 2015 at 06:49:51PM +0100, Bilel DRIRA wrote: > > This patch fixes the following sparse warnings: [] > > diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c [] > > @@ -245,10 +245,12 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, [] > > - memset(s3data, 0, sizeof(s3data)); > > + for (s3data_count = 0; s3data_count < S3DATA_MAX; s3data_count++) > > + memset(&s3data[s3data_count], 0, sizeof(struct s3datarec)); > > You are doing the exact same thing here that the original code did, so > why change it? > > That sparse warning is just a hint, I don't see anything wrong here with > the original code, sorry. Greg's right. A possible improvement would be to malloc/free memory as necessary instead of using large static buffers.