svn commit: r333860 - head/sys/kern
Matthew Macy
mmacy at freebsd.org
Wed May 23 22:52:43 UTC 2018
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 at 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
More information about the svn-src-head
mailing list