xfs
[Top] [All Lists]

[PATCH] One more bugfix for xfs_lowbit64

To: linux-xfs@xxxxxxxxxxx
Subject: [PATCH] One more bugfix for xfs_lowbit64
From: Andi Kleen <ak@xxxxxx>
Date: Fri, 22 Aug 2003 22:10:13 +0200
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4i
(mea culpa). The error return was broken too, it would return -2,
not -1 for errors. Makes no difference in the callers, they never check
for -1, but is still better to conform to the spec.

Includes the previous fix for bits > 32.

-Andi

--- linux-2.6.0test3/fs/xfs/xfs_bit.c-o 2003-05-27 03:00:41.000000000 +0200
+++ linux-2.6.0test3/fs/xfs/xfs_bit.c   2003-08-22 22:08:14.000000000 +0200
@@ -156,12 +156,12 @@
 {
        int n;
        n = ffs((unsigned)v);
-       if (n == 0) {
+       if (n < 0) {
                n = ffs(v >> 32);
                if (n >= 0)
                        n+=32;
        }
-       return n-1;
+       return (n < 0) ? n : n-1;
 }
 
 /*


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