linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: trix@redhat.com
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: initialize return of vm_insert_pages
Date: Fri, 3 Jul 2020 15:54:54 +0100	[thread overview]
Message-ID: <20200703145454.GH25523@casper.infradead.org> (raw)
In-Reply-To: <20200703145202.10629-1-trix@redhat.com>

On Fri, Jul 03, 2020 at 07:52:02AM -0700, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> clang static analysis reports a garbage return
> 
> In file included from mm/memory.c:84:
> mm/memory.c:1612:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
>         return err;
>         ^~~~~~~~~~
> 
> The setting of err depends on a loop executing.
> So initialize err.

I'd argue that returning zero is wrong.  If someone's asked to insert
zero pages, that's a nonsense thing to do so it should return -EINVAL..


  reply	other threads:[~2020-07-03 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 14:52 [PATCH] mm: initialize return of vm_insert_pages trix
2020-07-03 14:54 ` Matthew Wilcox [this message]
2020-07-03 15:46   ` Tom Rix

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=20200703145454.GH25523@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=trix@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).