From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753899AbdJNPW6 (ORCPT ); Sat, 14 Oct 2017 11:22:58 -0400 Received: from smtprelay0212.hostedemail.com ([216.40.44.212]:36656 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753261AbdJNPW4 (ORCPT ); Sat, 14 Oct 2017 11:22:56 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:2894:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:7576:8603:10004:10400:10848:11026:11232:11658:11914:12043:12048:12296:12740:12760:12895:13069:13255:13311:13357:13439:14181:14659:14721:21080:21627:30054:30075: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:2,LUA_SUMMARY:none X-HE-Tag: salt44_52b6ac3ab404c X-Filterd-Recvd-Size: 2034 Message-ID: <1507994566.814.17.camel@perches.com> Subject: Re: [PATCH] selinux: remove extraneous initialization of slots_used and max_chain_len From: Joe Perches To: Colin King , Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E . Hallyn" , Markus Elfring , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 14 Oct 2017 08:22:46 -0700 In-Reply-To: <20171014145224.840-1-colin.king@canonical.com> References: <20171014145224.840-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 Sat, 2017-10-14 at 15:52 +0100, Colin King wrote: > From: Colin Ian King > > Variables slots_used and max_chain_len are being initialized to zero > twice. Remove the first set of initializations. Cleans up the > clang warnings: > > Value stored to 'slots_used' is never read > Value stored to 'max_chain_len' is never read [] > diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c [] > @@ -148,8 +148,6 @@ void hashtab_stat(struct hashtab *h, struct hashtab_info *info) > u32 i, chain_len, slots_used, max_chain_len; > struct hashtab_node *cur; > > - slots_used = 0; > - max_chain_len = 0; > for (slots_used = max_chain_len = i = 0; i < h->size; i++) { > cur = h->htable[i]; > if (cur) { I think it'd be nicer if the assignments in the loop were removed instead. slots_used = 0; max_chain_len = 0; for (i = 0; i < h->size; i++) { etc...