Skip to contentSkip to conversation

cpumask.h: silence warning with -Wsign-compare

PATCH New Brian W Hart 1 participant 1 message May 1, 2014 Bitmap API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpumask.h: silence warning with -Wsign-compare

Silence the warning when building with -Wsign-compare when cpumask.h is included:

include/linux/cpumask.h: In function ‘cpumask_parse’:
include/linux/cpumask.h:603:26: warning: signed and unsigned type in conditional expression [-Wsign-compare]

  int len = nl ? nl - buf : strlen(buf);
                          ^

---
Compile tested only.

 include/linux/cpumask.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/cpumask.h +1 -1
index d08e4d2..0928ce7 100644
@@ -600,7 +600,7 @@ static inline int cpulist_scnprintf(char *buf, int len,
 static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
 {
 	char *nl = strchr(buf, '\n');
-	int len = nl ? nl - buf : strlen(buf);
+	int len = nl ? nl - buf : (int)strlen(buf);
 
 	return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
 }