public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ulrich Drepper <drepper@redhat.com>,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH] compat: fix compat_sys_openat and friends
Date: Thu, 2 Feb 2006 12:01:10 +0000	[thread overview]
Message-ID: <20060202120109.GA5273@linux-mips.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0602012134150.21884@g5.osdl.org>

On Wed, Feb 01, 2006 at 09:36:40PM -0800, Linus Torvalds wrote:

> > Most of the 64 bit architectures will zero extend the first argument to
> > compat_sys_{openat,newfstatat,futimesat} which will fail if the 32 bit
> > syscall was passed AT_FDCWD (which is a small negative number).  Declare
> > the first argument to be an unsigned int which will force the correct
> > sign extension when the internal functions are called in each case.
> 
> Umm.
> 
> Wouldn't it be _much_ better to declare the argument as a "long", since 
> some architectures (alpha, for example) may assume that 32-bit arguments 
> have been _sign_extended, not zero-extended.

> Then, when the "compat_sys_xxxx()" function passes the "long" down to the 
> _real_ function (which takes an "int"), those architectures (and only 
> those architectures) that actually have assumptions about high bits will 
> have the compiler automatically do the right zero- or sign-extensions at 
> that call-site.

MIPS is one of those architectures where variables are always held
sign-extended to the full 32-bit or 64-bit size of the register.  The
signed-ness of the C data type doesn't matter at all here so Stephen's
change is a nop for MIPS.

  Ralf

      parent reply	other threads:[~2006-02-02 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02  5:11 [PATCH] compat: fix compat_sys_openat and friends Stephen Rothwell
2006-02-02  5:36 ` Linus Torvalds
2006-02-02  5:56   ` David S. Miller
2006-02-02  6:05     ` Stephen Rothwell
2006-02-02  6:11       ` Linus Torvalds
2006-02-02 12:01   ` Ralf Baechle [this message]

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=20060202120109.GA5273@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox