* [PATCH v2] cpumask.h: silence warning with -Wsign-compare
@ 2014-05-05 15:21 Brian W Hart
2014-05-06 1:01 ` Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Brian W Hart @ 2014-05-05 15:21 UTC (permalink / raw)
To: tj, rusty, linux-kernel, trivial
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);
^
V2: Rusty pointed out that unsigned should be used instead.
Signed-off-by: Brian W Hart <hartb@linux.vnet.ibm.com>
---
include/linux/cpumask.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d08e4d2..3557ea7 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -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);
+ unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-06 1:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 15:21 [PATCH v2] cpumask.h: silence warning with -Wsign-compare Brian W Hart
2014-05-06 1:01 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox