All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/1] mmap: fix uninitialized entities warnings.
Date: Thu, 01 May 2008 21:05:19 +0000	[thread overview]
Message-ID: <20080501210518.GY14976@parisc-linux.org> (raw)
In-Reply-To: <1209668812-17641-1-git-send-email-ricardo@scarybox.net>

On Thu, May 01, 2008 at 11:40:37PM +0300, Adrian Bunk wrote:
> On Thu, May 01, 2008 at 02:25:33PM -0600, Matthew Wilcox wrote:
> > However, the code is not buggy.  Just compare:
> > 
> >                         vma = vma_tmp;
> >                         if (vma_tmp->vm_start <= addr)
> >                                 return vma;
> > 
> > with
> > 
> > munmap_back:
> >         vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);
> >         if (vma && vma->vm_start < addr + len) {
> >                 if (do_munmap(mm, addr, len))
> >                         return -ENOMEM;
> >                 goto munmap_back;
> >         }
> > 
> > Now, we know that addr + len does not wrap, and that len > 0, so we know
> > that this warning is incorrect.  But it's not reasonable to expect gcc to
> > be able to deduce this.
> >...
> 
> Can you submit a patch with your explanation that uses 
> uninitialized_var() to silence these warnings?

I could, but I don't know if I want to.  Suppose somebody changes the
code later to actually make prev used before it's initialised?  Then we
would have GCC not warning about a problem.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

  parent reply	other threads:[~2008-05-01 21:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-01 19:06 [PATCH 1/1] mmap: fix uninitialized entities warnings Ricardo Martins
2008-05-01 19:16 ` Matthew Wilcox
2008-05-01 19:43 ` Adrian Bunk
2008-05-01 19:54 ` Ricardo Martins
2008-05-01 20:25 ` Matthew Wilcox
2008-05-01 20:40 ` Adrian Bunk
2008-05-01 21:05 ` Matthew Wilcox [this message]
2008-05-01 21:13 ` Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080501210518.GY14976@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.