All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: mempolicy: turn vma_set_policy() into vma_dup_policy()
Date: Thu, 11 Jul 2013 15:27:46 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1307111524400.2458@chino.kir.corp.google.com> (raw)
In-Reply-To: <20130711152006.de0900cfcd784f2833285ee4@linux-foundation.org>

On Thu, 11 Jul 2013, Andrew Morton wrote:

> On Thu, 11 Jul 2013 15:13:03 -0700 (PDT) David Rientjes <rientjes@google.com> wrote:
> 
> > > +int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
> > > +{
> > > +	struct mempolicy *pol = mpol_dup(vma_policy(src));
> > > +
> > > +	if (IS_ERR(pol))
> > > +		return PTR_ERR(pol);
> > 
> > PTR_ERR() returns long, so vma_dup_policy() needs to return long.
> 
> hm, really?  vma_dup_policy() returns an errno and errnos have type "int".
> 
> Arguably it is PTR_ERR() which returns the wrong type...
> 

PTR_ERR() may not imply IS_ERR(), which I believe Rusty is trying to fix 
with his series that fixes up abuses of PTR_ERR().  But I agree that 
vma_dup_policy() can return int because of the IS_ERR() check as written.  

For complete correctness there should probably be a build error if 
MAX_ERRNO cannot fit in an int and then this should do 
return (int)PTR_ERR(pol) to make it clear.

  reply	other threads:[~2013-07-11 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 17:02 [PATCH] mm: mempolicy: turn vma_set_policy() into vma_dup_policy() Oleg Nesterov
2013-07-11 22:13 ` David Rientjes
2013-07-11 22:20   ` Andrew Morton
2013-07-11 22:27     ` David Rientjes [this message]
2013-07-11 22:33       ` Andrew Morton
2013-07-11 22:54         ` David Rientjes
2013-07-12 15:32   ` Oleg Nesterov

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=alpine.DEB.2.02.1307111524400.2458@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=oleg@redhat.com \
    --cc=riel@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 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.