I don't quite understand in what units cpusetsize should be, but if in
bytes then this patch should be applied IMHO.
Index: src/libplpa/plpa_dispatch.c
===================================================================
--- src/libplpa/plpa_dispatch.c (revision 47)
+++ src/libplpa/plpa_dispatch.c (working copy)
@@ -30,7 +30,7 @@
switch (PLPA_NAME(api_probe)()) {
case PLPA_PROBE_OK:
/* This shouldn't happen, but check anyway */
- if (cpusetsize > PLPA_BITMASK_NUM_ELEMENTS) {
+ if (cpusetsize > sizeof (*cpuset)) {
return EINVAL;
}
if (NULL == cpuset) {
@@ -60,7 +60,7 @@
will accept into a temporary and use that. Again,
efficinency is not the issue of this code -- clarity is. */
else if (cpusetsize > PLPA_NAME(len)) {
- for (i = PLPA_NAME(len); i < cpusetsize * 8; ++i) {
+ for (i = PLPA_NAME(len) * 8; i < cpusetsize * 8; ++i) {
if (PLPA_CPU_ISSET(i, cpuset)) {
return EINVAL;
}
@@ -68,7 +68,7 @@
/* No upper-level bits are set, so now copy over the bits
that the kernel will look at */
memset(&tmp, 0, sizeof(tmp));
- for (i = 0; i < PLPA_NAME(len); ++i) {
+ for (i = 0; i < PLPA_NAME(len) * 8; ++i) {
if (PLPA_CPU_ISSET(i, cpuset)) {
PLPA_CPU_SET(i, &tmp);
}
--
Gleb.
|