From patchwork Wed May 13 18:11:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 6399311 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45B1DBEEE1 for ; Wed, 13 May 2015 18:11:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C44C20435 for ; Wed, 13 May 2015 18:11:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 425832026F for ; Wed, 13 May 2015 18:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752393AbbEMSLp (ORCPT ); Wed, 13 May 2015 14:11:45 -0400 Received: from fieldses.org ([173.255.197.46]:45045 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752555AbbEMSLo (ORCPT ); Wed, 13 May 2015 14:11:44 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 3D0D9C56; Wed, 13 May 2015 14:11:43 -0400 (EDT) Date: Wed, 13 May 2015 14:11:43 -0400 From: "J. Bruce Fields" To: Arnd Bergmann Cc: linux-nfs@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nfsd: work around a gcc-5.1 warning Message-ID: <20150513181143.GD2827@fieldses.org> References: <2121336.tAfQfAWQ2u@wuerfel> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2121336.tAfQfAWQ2u@wuerfel> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tue, May 12, 2015 at 11:31:29PM +0200, Arnd Bergmann wrote: > gcc-5.0 warns about a potential uninitialized variable use in nfsd: > > fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2': > fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized] > reset_union_bmap_deny(old_deny_bmap, stp); > ^ > fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here > unsigned char old_deny_bmap; > ^ > > This is a false positive, the code path that is warned about cannot > actually be reached. > > This adds an initialization for the variable to make the warning go > away. > > Signed-off-by: Arnd Bergmann > --- > This warning shows up in some ARM defconfig builds, which we try to > build with no warnings to detect regressions. OK, I guess. How about simplifying slightly and doing it this way?--b commit 3ae81ac291ec Author: Arnd Bergmann Date: Tue May 12 23:31:29 2015 +0200 nfsd: work around a gcc-5.1 warning gcc-5.0 warns about a potential uninitialized variable use in nfsd: fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2': fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized] reset_union_bmap_deny(old_deny_bmap, stp); ^ fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here unsigned char old_deny_bmap; ^ This is a false positive, the code path that is warned about cannot actually be reached. This adds an initialization for the variable to make the warning go away. Signed-off-by: Arnd Bergmann Signed-off-by: J. Bruce Fields --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 86f5c273c9ec..aef7c9bb6114 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3861,7 +3861,7 @@ static __be32 nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open) { __be32 status; - unsigned char old_deny_bmap; + unsigned char old_deny_bmap = stp->st_deny_bmap; if (!test_access(open->op_share_access, stp)) return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open); @@ -3870,7 +3870,6 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c spin_lock(&fp->fi_lock); status = nfs4_file_check_deny(fp, open->op_share_deny); if (status == nfs_ok) { - old_deny_bmap = stp->st_deny_bmap; set_deny(open->op_share_deny, stp); fp->fi_share_deny |= (open->op_share_deny & NFS4_SHARE_DENY_BOTH);