Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753300AbdGJI6M (ORCPT ); Mon, 10 Jul 2017 04:58:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50012 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbdGJI6L (ORCPT ); Mon, 10 Jul 2017 04:58:11 -0400 From: Rui Teng To: Aditya Shankar , Ganesh Krishna , Greg Kroah-Hartman Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Rui Teng Subject: [PATCH] drivers/staging/wilc1000: fix sparse warning: right shift by bigger than source value Date: Mon, 10 Jul 2017 16:57:31 +0800 X-Mailer: git-send-email 2.11.0 X-TM-AS-GCONF: 00 x-cbid: 17071008-0016-0000-0000-00000723AF21 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007341; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00885462; UDB=6.00441905; IPR=6.00665621; BA=6.00005462; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016155; XFM=3.00000015; UTC=2017-07-10 08:57:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071008-0017-0000-0000-00003A81495F Message-Id: <20170710085731.28397-1-rui.teng@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-10_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707100161 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1170 Lines: 29 This patch sets memory to zero directly to avoid unnecessary shift and bitwise operations on bool type, which can fix a sparse warning and also improve performance. Signed-off-by: Rui Teng --- drivers/staging/wilc1000/host_interface.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 2568dfc15181..036c5c19a016 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -2416,10 +2416,9 @@ static void Handle_SetMulticastFilter(struct wilc_vif *vif, goto ERRORHANDLER; pu8CurrByte = wid.val; - *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); - *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); + memset(pu8CurrByte, 0, 4); + *pu8CurrByte = (strHostIfSetMulti->enabled & 0xFF); + pu8CurrByte += 4; *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); -- 2.11.0