From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbdJRWyh (ORCPT ); Wed, 18 Oct 2017 18:54:37 -0400 Received: from smtprelay0027.hostedemail.com ([216.40.44.27]:41229 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750975AbdJRWyg (ORCPT ); Wed, 18 Oct 2017 18:54:36 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2693:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3871:3874:4321:5007:6119:6238:7208:7576:7903:8957:9113:10004:10400:10848:11232:11658:11914:12043:12048:12296:12438:12555:12740:12760:12895:13069:13311:13357:13439:14093:14096:14097:14181:14659:14721:21080:21451:21627:30012:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: seed74_27c8f7d64683c X-Filterd-Recvd-Size: 2600 Message-ID: <1508367271.6806.25.camel@perches.com> Subject: Re: [PATCH] staging: wilc1000: replace redundant computations with 0 From: Joe Perches To: Colin King , Aditya Shankar , Ganesh Krishna , Greg Kroah-Hartman , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 18 Oct 2017 15:54:31 -0700 In-Reply-To: <20171010140548.18016-1-colin.king@canonical.com> References: <20171010140548.18016-1-colin.king@canonical.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 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 Tue, 2017-10-10 at 15:05 +0100, Colin King wrote: > From: Colin Ian King > > Shifting and masking strHostIfSetMulti->enabled is redundant since > enabled is a bool and so all the shifted and masked values will be > zero. Replace them with zero to simplify the code. > > Detected by CoverityScan, CID#1339458 ("Bad shift operation") and > CID#1339506 ("Operands don't affect result"). > > Signed-off-by: Colin Ian King > --- > drivers/staging/wilc1000/host_interface.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c > index 7b620658ec38..94477dd08c85 100644 > --- a/drivers/staging/wilc1000/host_interface.c > +++ b/drivers/staging/wilc1000/host_interface.c > @@ -2417,9 +2417,9 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, > > pu8CurrByte = wid.val; > *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); > - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); > - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); > - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); > + *pu8CurrByte++ = 0; > + *pu8CurrByte++ = 0; > + *pu8CurrByte++ = 0; This might be more an indication of another defect Perhaps this is just supposed to be *pu8CurrByte++ = strHostIfSetMulti->enabled; without the three byte sets to zero after that. > *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); > *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF);