Skip to content

Commit

Permalink
fix overflow
Browse files Browse the repository at this point in the history
Change-Id: Iecb136245191a09e7556664d530a00c8a79d5721
  • Loading branch information
rdementi authored and opcm committed Oct 20, 2017
1 parent 6534f88 commit cdef1df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cpucounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5034,18 +5034,18 @@ void ServerPCICFGUncore::initMemTest(ServerPCICFGUncore::MemTestParam & param)
std::cerr << "ERROR: mmap failed" << std::endl;
return;
}
unsigned long maxNode = (unsigned long)(readMaxFromSysFS("/sys/devices/system/node/online") + 1);
unsigned long long maxNode = (unsigned long long)(readMaxFromSysFS("/sys/devices/system/node/online") + 1);
if (maxNode == 0)
{
std::cerr << "ERROR: max node is 0 " << std::endl;
return;
}
if (maxNode >= 63) maxNode = 63;
const unsigned long nodeMask = (1 << maxNode) - 1;
const unsigned long long nodeMask = (1ULL << maxNode) - 1ULL;
if (0 != syscall(SYS_mbind, buffer, capacity, 3 /* MPOL_INTERLEAVE */,
&nodeMask, maxNode, 0))
{
std::cerr << "ERROR: mbind failed" << std::endl;
std::cerr << "ERROR: mbind failed. nodeMask: "<< nodeMask << " maxNode: "<< maxNode << std::endl;
return;
}
memBuffers.push_back((uint64 *)buffer);
Expand Down Expand Up @@ -5529,4 +5529,4 @@ void PCM::setupCustomCoreEventsForNuma(PCM::ExtendedCustomCoreEventDescription&
default:
throw UnsupportedProcessorException();
}
}
}

0 comments on commit cdef1df

Please sign in to comment.