Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp439831pxu; Wed, 25 Nov 2020 07:03:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAmhr9p72IAb1hB3vH4iKGRLetIpOu477Ak4OeFLm0rb6nM9XOVZYYaBMYoBV/P6DdtLTm X-Received: by 2002:a17:907:2166:: with SMTP id rl6mr3475882ejb.61.1606316630461; Wed, 25 Nov 2020 07:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606316630; cv=none; d=google.com; s=arc-20160816; b=Vuh5/XfZUnb+U/CZm29AsybphQj1I5xQElEhNvmEHjZ2+7jmgNhAA6f1BUu8TQussd dDM5g1pWNwR1Gc5vojBuH6dmUtV8+VAm7ckk2ajPomXNFgO2RcundG6lho85jyMktGFP m/jcXoHDs8SFrOk02x4E+zOwdW2gqm17YkUJ0qD2U9KC9Dzqo/bY4vPm5vgnxGwwI4Ma svsTaojNmdAG4GXY3F3AxU+CW3G9SZjTXxodyJO2GjU8+LZuxkWC7IKr+0v1h6K8CaxL LtPVanhNjF4V1jvR5T9YDRdZiIg2dJ+tjoDk8JGMMTGKRyx3I/WZxDDeLQrjgkm9Gekk R0Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to; bh=aDEmawM8mVmnZaj0BXpOTFNvdt6eAcHgrbj1mhQZvMo=; b=PNbKJ9sPcAg0XB9KTFp8N29xK+xl9v2N2gydaxEllWZpIOUMJftJLiIhLdmOztcOrv QWiWkWa6getLaTjqCha8sMzb+wY/v5VnuqibWic3wAunTaS4dP3Rs3e2DJEEQf8W0bBn y4GhN0Ot2WD/3xQyk3yNdF+zXdWZ68fmL2VyDt2WUvBRBeo1JIhoKdfhoEpgzWV/3nMo apJ0Sk0wUWb7taSa5MWBYRF2zzl3wx7dBKwZlz8Hylk9hcbvSF//Q5OpL5i7ffP2pa8v n9zV+b82jVBDyLZOnL6K0zIAqz4AyrjT5XR3LRxQn/o28HaCqaA28OgZNSCQM1/xZIss k7hQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp16si1508116ejc.625.2020.11.25.07.03.21; Wed, 25 Nov 2020 07:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727611AbgKYOux (ORCPT + 99 others); Wed, 25 Nov 2020 09:50:53 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:41083 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbgKYOux (ORCPT ); Wed, 25 Nov 2020 09:50:53 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1khw8B-0004os-VH; Wed, 25 Nov 2020 14:50:52 +0000 To: "J. Bruce Fields" Cc: Chuck Lever , "linux-nfs@vger.kernel.org" From: Colin Ian King Subject: re: nfsd: skip some unnecessary stats in the v4 case Message-ID: Date: Wed, 25 Nov 2020 14:50:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi, Static analysis on today's linux-next has found an issue with the following commit: commit 55ea6691d52875b921d3712f9a08db8e81e059b4 Author: J. Bruce Fields Date: Fri Nov 20 17:39:19 2020 -0500 nfsd: skip some unnecessary stats in the v4 case The analysis is as follows: 286 /* 287 * Fill in the post_op attr for the wcc data 288 */ 289 void fill_post_wcc(struct svc_fh *fhp) 290 { 291 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE); 292 struct inode *inode = d_inode(fhp->fh_dentry); 1. var_decl: Declaring variable err without initializer. 293 __be32 err; 294 2. Condition fhp->fh_post_saved, taking true branch. 295 if (fhp->fh_post_saved) 296 printk("nfsd: inode locked twice during operation.\n"); 297 298 3. Condition !v4, taking false branch. 4. Condition !inode->i_sb->s_export_op->fetch_iversion, taking false branch. 299 if (!v4 || !inode->i_sb->s_export_op->fetch_iversion) 300 err = fh_getattr(fhp, &fhp->fh_post_attr); 5. Condition v4, taking true branch. 301 if (v4) 302 fhp->fh_post_change = 303 nfsd4_change_attribute(&fhp->fh_post_attr, inode); Uninitialized scalar variable (UNINIT)6. uninit_use: Using uninitialized value err. 304 if (err) { 305 fhp->fh_post_saved = false; 306 /* Grab the ctime anyway - set_change_info might use it */ 307 fhp->fh_post_attr.ctime = inode->i_ctime; 308 } else 309 fhp->fh_post_saved = true; 310 } Prior to this commit, variable err used to be always assigned by the call to err = fh_getattr(fhp, &stat), but now it is only called on specific conditions, so now we have this unassigned err issue. Colin