Date: Wed, 23 May 2018 15:52:42 -0700 From: Matthew Macy <mmacy@freebsd.org> To: Gleb Smirnoff <glebius@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r333860 - head/sys/kern Message-ID: <CAPrugNpKxEVx%2Bg0D6qUwq=yw_W-QeuntupwAjteK1yALkJktag@mail.gmail.com> In-Reply-To: <20180523222743.GU71675@FreeBSD.org> References: <201805190510.w4J5AqfS054367@repo.freebsd.org> <20180523222743.GU71675@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Talk to the gcc devs. The warning is useful even if there are false positives. On Wed, May 23, 2018 at 3:27 PM, Gleb Smirnoff <glebius@freebsd.org> wrote: > Hi, > > On Sat, May 19, 2018 at 05:10:52AM +0000, Matt Macy wrote: > M> Author: mmacy > M> Date: Sat May 19 05:10:51 2018 > M> New Revision: 333860 > M> URL: https://svnweb.freebsd.org/changeset/base/333860 > M> > M> Log: > M> sendfile: annotate unused value and ensure that npages is actually initialized > M> > M> Modified: > M> head/sys/kern/kern_sendfile.c > M> > M> Modified: head/sys/kern/kern_sendfile.c > M> ============================================================================== > M> --- head/sys/kern/kern_sendfile.c Sat May 19 05:09:10 2018 (r333859) > M> +++ head/sys/kern/kern_sendfile.c Sat May 19 05:10:51 2018 (r333860) > M> @@ -341,7 +341,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o > M> } > M> > M> for (int i = 0; i < npages;) { > M> - int j, a, count, rv; > M> + int j, a, count, rv __unused; > M> > M> /* Skip valid pages. */ > M> if (vm_page_is_valid(pa[i], vmoff(i, off) & PAGE_MASK, > M> @@ -688,6 +688,7 @@ retry_space: > M> if (space == 0) { > M> sfio = NULL; > M> nios = 0; > M> + npages = 0; > M> goto prepend_header; > M> } > M> hdr_uio = NULL; > > This initialization is redundant and a compiler warning if exists is wrong. > > If we jump down to prepend_header with nios == 0, we won't ever use npages. > > -- > Gleb Smirnoff
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPrugNpKxEVx%2Bg0D6qUwq=yw_W-QeuntupwAjteK1yALkJktag>