Messages in this thread Patch in this message | | | Subject | [PATCH] Fix cpu iterator on empty bitmask | From | Rusty Russell <> | Date | Wed, 28 Apr 2004 09:52:53 +1000 |
| |
Name: Fix cpumask iterator over empty cpu set Status: Trivial
Can't use _ffs() without first checking for zero, and if bits beyond NR_CPUS set it'll give bogus results. Use find_first_bit
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .26180-linux-2.6.6-rc2-bk5/include/asm-generic/cpumask_arith.h .26180-linux-2.6.6-rc2-bk5.updated/include/asm-generic/cpumask_arith.h --- .26180-linux-2.6.6-rc2-bk5/include/asm-generic/cpumask_arith.h 2004-01-10 13:59:33.000000000 +1100 +++ .26180-linux-2.6.6-rc2-bk5.updated/include/asm-generic/cpumask_arith.h 2004-04-28 09:50:23.000000000 +1000 @@ -43,7 +43,7 @@ #define cpus_promote(map) ({ map; }) #define cpumask_of_cpu(cpu) ({ ((cpumask_t)1) << (cpu); }) -#define first_cpu(map) __ffs(map) +#define first_cpu(map) find_first_bit(&(map), NR_CPUS) #define next_cpu(cpu, map) find_next_bit(&(map), NR_CPUS, cpu + 1) #endif /* __ASM_GENERIC_CPUMASK_ARITH_H */ -- Anyone who quotes me in their signature is an idiot -- Rusty Russell - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |