From owner-svn-src-all@freebsd.org Sun Feb 7 07:32:40 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49799A9E716; Sun, 7 Feb 2016 07:32:40 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 11C419AA; Sun, 7 Feb 2016 07:32:39 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id DBF6C4285F2; Sun, 7 Feb 2016 18:32:36 +1100 (AEDT) Date: Sun, 7 Feb 2016 18:32:36 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r295359 - head/sys/fs/fdescfs In-Reply-To: <201602070109.u1719dcr053281@repo.freebsd.org> Message-ID: <20160207182245.J867@besplex.bde.org> References: <201602070109.u1719dcr053281@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=R4L+YolX c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=iZa051W5lHYdGRtyBqQA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Feb 2016 07:32:40 -0000 On Sun, 7 Feb 2016, Pedro F. Giffuni wrote: > Log: > fdesc_setattr: unitialized pointer read > > CID: 1018688 Bug in Coverity. > Modified: head/sys/fs/fdescfs/fdesc_vnops.c > ============================================================================== > --- head/sys/fs/fdescfs/fdesc_vnops.c Sun Feb 7 01:04:47 2016 (r295358) > +++ head/sys/fs/fdescfs/fdesc_vnops.c Sun Feb 7 01:09:38 2016 (r295359) > @@ -465,7 +465,7 @@ fdesc_setattr(ap) > { > struct vattr *vap = ap->a_vap; > struct vnode *vp; > - struct mount *mp; > + struct mount *mp = NULL; > struct file *fp; > struct thread *td = curthread; > cap_rights_t rights; 2 style bugs in the caller to hide the Coverity bug: - initialization in declaration - unused initialization The initialization is done by calling vn_start_write(... &mp, flags). mp is only an output parameter unless (flags & V_MNTREF), and fdesc doesn't put V_MNTREF in flags. This is a common way of returning extra values so it shouldn't cause warning is the source code doesn't have bogus initializations in the caller. Compilers that look at only 1 source file at a time can't see the full API so they have to assume that such parameters are output-only if they are uninitialized in callers. Checkers need to understand the API if they want to do more. Bruce