All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jeff Mahoney <jeffm@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Al Viro <viro@ftp.linux.org.uk>
Subject: Re: [PATCH] dup2: Fix return value with oldfd == newfd and invalid fd
Date: Mon, 11 May 2009 20:11:42 +0100	[thread overview]
Message-ID: <20090511191142.GK8633@ZenIV.linux.org.uk> (raw)
In-Reply-To: <alpine.LFD.2.01.0905111135560.3586@localhost.localdomain>

On Mon, May 11, 2009 at 11:40:56AM -0700, Linus Torvalds wrote:
> 
> 
> On Mon, 11 May 2009, Jeff Mahoney wrote:
> > 
> >  The return value of dup2 when oldfd == newfd and the fd isn't valid is not
> >  getting properly sign extended. We end up with 4294967287 instead of -EBADF.
> 
> Indeed.
> 
> >  This patch uses a signed int for the error value so it is properly extended.
> 
> However, I'd rather move the new variable into the block where it is used, 
> and keep the whole corner-case thing self-contained.
> 
> So can you verify that this trivial variation on the patch is ok by you, 
> and I'll commit it as yours with your message? (I realize it's really 
> trivial, and I could just do this myself, but good to get the change 
> ack'ed anyway).

I'm not sure that it's a right fix, actually.  Note that userland declaration
of that sucker is int dup2(int, int); so should we really take unsigned int
as arguments?

  parent reply	other threads:[~2009-05-11 19:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 18:25 [PATCH] dup2: Fix return value with oldfd == newfd and invalid fd Jeff Mahoney
2009-05-11 18:40 ` Linus Torvalds
2009-05-11 19:00   ` Jeff Mahoney
2009-05-11 19:11   ` Al Viro [this message]
2009-05-11 19:26     ` Linus Torvalds
2009-05-11 19:49       ` Al Viro

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=20090511191142.GK8633@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=jeffm@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@ftp.linux.org.uk \
    /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.