From 7cd8ebe7d68ef0816df4a1a4efe977f7d70d7c04 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 27 Apr 2004 04:30:50 -0700 Subject: [PATCH] [PATCH] Fix cpumask iterator over empty cpu set 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 --- include/asm-generic/cpumask_arith.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-generic/cpumask_arith.h b/include/asm-generic/cpumask_arith.h index 7325284843dd..b4d25ac46a9f 100644 --- a/include/asm-generic/cpumask_arith.h +++ b/include/asm-generic/cpumask_arith.h @@ -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 */ -- 2.39.5