[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#395564: X server enters cpu loop on startup following 7.1 upgrade



reassign 395564 xserver-xorg-core
retitle 395564 Broken ffs() implementation in dix/ffs.c may deadlock
tags 395564 confirmed upstream patch
thanks

Hi,

I've tracked down the problem to the faulty implementation of ffs() 
function in dix/ffs.c, which will loop indefinitely if input is 0.
Obvious patch (attached) fixes the problem.

Best regards,
-- 
Jurij Smakov                                           jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
diff -aur a/dix/ffs.c b/dix/ffs.c
--- a/dix/ffs.c	2006-07-05 11:31:36.000000000 -0700
+++ b/dix/ffs.c	2006-11-09 21:46:11.000000000 -0800
@@ -31,6 +31,7 @@
 ffs(int i)
 {
     int j;
+    if (i == 0) return 0;
     for (j = 1; (i & 1) == 0; j++)
 	i >>= 1;
     return j;

Reply to: