Re: [PATCH] fix sys cpumap for > 352 NR_CPUS

From: Paul Jackson
Date: Thu Jun 03 2004 - 10:58:59 EST


This patch (fix-sys-cpumap-for-352-nr_cpus) doesn't work. Passing -1UL
to cpumask_scnprintf() suppresses all of the requested output, because
of the following code in lib/vsprintf.c vsnprintf():

/* Reject out-of-range values early */
if (unlikely((int) size < 0)) {
/* There can be only one.. */
static int warn = 1;
WARN_ON(warn);
warn = 0;
return 0;
}

Using PAGE_SIZE works ok. Well, lets throw in a -1 to leave a slot for
the newline, while we're here.

Signed-off-by: Paul Jackson <pj@xxxxxxx>

Index: 2.6.7-rc2-mm2/drivers/base/node.c
===================================================================
--- 2.6.7-rc2-mm2.orig/drivers/base/node.c 2004-06-03 08:24:19.000000000 -0700
+++ 2.6.7-rc2-mm2/drivers/base/node.c 2004-06-03 08:26:12.000000000 -0700
@@ -24,7 +24,7 @@ static ssize_t node_read_cpumap(struct s
/* 2004/06/03: buf currently PAGE_SIZE, need > 1 char per 4 bits. */
BUILD_BUG_ON(NR_CPUS/4 > PAGE_SIZE/2);

- len = cpumask_scnprintf(buf, -1UL, mask);
+ len = cpumask_scnprintf(buf, PAGE_SIZE-1, mask);
len += sprintf(buf + len, "\n");
return len;
}


--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/