xfs-masters
[Top] [All Lists]

[xfs-masters] Re: ffs()

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: [xfs-masters] Re: ffs()
From: Linus Torvalds <torvalds@xxxxxxxx>
Date: Thu, 3 Jun 2004 15:22:51 -0700 (PDT)
Cc: akpm@xxxxxxxx, xfs-masters@xxxxxxxxxxx, nathans@xxxxxxx
In-reply-to: <20040603151009.6edd1c0b.davem@redhat.com>
References: <20040603143710.326e56ca.davem@redhat.com> <Pine.LNX.4.58.0406031504031.3403@ppc970.osdl.org> <20040603151009.6edd1c0b.davem@redhat.com>
Reply-to: xfs-masters@xxxxxxxxxxx
Sender: xfs-masters-bounce@xxxxxxxxxxx

On Thu, 3 Jun 2004, David S. Miller wrote:
> 
> [ Nathan, the issue is that XFS calls ffs() potentially with an arg
>   value of zero which is illegal and has undefined behavior, the
>   XFS code is depending upon ffs() returning -1 in this case. ]

Hmm. It can't depend on -1, since at least on x86, it returns zero. 

Do you mean "depend on 0"?

Anyway, having looked at it a bit more, maybe depending on that zero is 
actually acceptable. I notice that at least x86, alpha and the generic 
implementation all do that, and the man-page implies that is the case for 
the gcc builtin and for the user-space version too.

So maybe I was wrong to call it underfined. That was what the original 
kernel ffs() used to be, but that was a _long_ time ago.

                Linus

<Prev in Thread] Current Thread [Next in Thread>