Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 May 2018 15:57:29 -0700
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Matthew Macy <mmacy@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:  <20180523225729.GV71675@FreeBSD.org>
In-Reply-To: <CAPrugNpKxEVx%2Bg0D6qUwq=yw_W-QeuntupwAjteK1yALkJktag@mail.gmail.com>
References:  <201805190510.w4J5AqfS054367@repo.freebsd.org> <20180523222743.GU71675@FreeBSD.org> <CAPrugNpKxEVx%2Bg0D6qUwq=yw_W-QeuntupwAjteK1yALkJktag@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
The initialization isn't useful.

On Wed, May 23, 2018 at 03:52:42PM -0700, Matthew Macy wrote:
M> Talk to the gcc devs. The warning is useful even if there are false positives.
M> 
M> On Wed, May 23, 2018 at 3:27 PM, Gleb Smirnoff <glebius@freebsd.org> wrote:
M> >   Hi,
M> >
M> > On Sat, May 19, 2018 at 05:10:52AM +0000, Matt Macy wrote:
M> > M> Author: mmacy
M> > M> Date: Sat May 19 05:10:51 2018
M> > M> New Revision: 333860
M> > M> URL: https://svnweb.freebsd.org/changeset/base/333860
M> > M>
M> > M> Log:
M> > M>   sendfile: annotate unused value and ensure that npages is actually initialized
M> > M>
M> > M> Modified:
M> > M>   head/sys/kern/kern_sendfile.c
M> > M>
M> > M> Modified: head/sys/kern/kern_sendfile.c
M> > M> ==============================================================================
M> > M> --- head/sys/kern/kern_sendfile.c    Sat May 19 05:09:10 2018        (r333859)
M> > M> +++ head/sys/kern/kern_sendfile.c    Sat May 19 05:10:51 2018        (r333860)
M> > M> @@ -341,7 +341,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
M> > M>      }
M> > M>
M> > M>      for (int i = 0; i < npages;) {
M> > M> -            int j, a, count, rv;
M> > M> +            int j, a, count, rv __unused;
M> > M>
M> > M>              /* Skip valid pages. */
M> > M>              if (vm_page_is_valid(pa[i], vmoff(i, off) & PAGE_MASK,
M> > M> @@ -688,6 +688,7 @@ retry_space:
M> > M>                      if (space == 0) {
M> > M>                              sfio = NULL;
M> > M>                              nios = 0;
M> > M> +                            npages = 0;
M> > M>                              goto prepend_header;
M> > M>                      }
M> > M>                      hdr_uio = NULL;
M> >
M> > This initialization is redundant and a compiler warning if exists is wrong.
M> >
M> > If we jump down to prepend_header with nios == 0, we won't ever use npages.
M> >
M> > --
M> > Gleb Smirnoff

-- 
Gleb Smirnoff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180523225729.GV71675>