commit 25d538d34fbe2e024d24920b72a761f72533f583 Author: bgoglin Date: Thu Nov 11 15:30:59 2010 +0000 Fix the zeroing of the destination ulongs in hwloc_cpuset/nodeset_to_linux_libnuma_ulongs Thanks to Jirka Hladky for the report git-svn-id: https://svn.open-mpi.org/svn/hwloc/trunk@2773 4b44e086-7f34-40ce-a3bd-00e031736276 diff --git a/include/hwloc/linux-libnuma.h b/include/hwloc/linux-libnuma.h index b29f6c7..44d6abd 100644 --- a/include/hwloc/linux-libnuma.h +++ b/include/hwloc/linux-libnuma.h @@ -47,7 +47,8 @@ hwloc_cpuset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_cpus unsigned long outmaxnode = -1; /* round-up to the next ulong and clear all bytes */ - memset(mask, 0, (*maxnode+8*sizeof(*mask)-1)/8); + *maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1); + memset(mask, 0, *maxnode/8); if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) { hwloc_obj_t node = NULL; @@ -89,7 +90,8 @@ hwloc_nodeset_to_linux_libnuma_ulongs(hwloc_topology_t topology, hwloc_const_nod unsigned long outmaxnode = -1; /* round-up to the next ulong and clear all bytes */ - memset(mask, 0, (*maxnode+8*sizeof(*mask)-1)/8); + *maxnode = (*maxnode + 8*sizeof(*mask) - 1) & ~(8*sizeof(*mask) - 1); + memset(mask, 0, *maxnode/8); if (depth != HWLOC_TYPE_DEPTH_UNKNOWN) { hwloc_obj_t node = NULL;