Skip to content

Commit fe486c7

Browse files
committed
Add asserts to testNuma checkModeInterleaveCustomPartSize
Add asserts to testNuma checkModeInterleaveCustomPartSize to verify that index has a correct value. It makes sure the Coverity issue no. 468463 never happens. Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 55db2a3 commit fe486c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/provider_os_memory_multiple_numa_nodes.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,11 @@ TEST_F(testNuma, checkModeInterleaveCustomPartSize) {
419419
// Get the first numa node for ptr; Each next part is expected to be on next nodes.
420420
int index = -1;
421421
ASSERT_NO_FATAL_FAILURE(getNumaNodeByPtr(ptr, &index));
422+
ASSERT_LT(index, numa_nodes.size());
422423
for (size_t i = 0; i < (size_t)part_num; i++) {
423424
for (size_t j = 0; j < part_size; j += page_size) {
425+
ASSERT_GE(index, 0);
426+
ASSERT_LT(index, numa_nodes.size());
424427
ASSERT_NODE_EQ((char *)ptr + part_size * i + j, numa_nodes[index]);
425428
}
426429
index = (index + 1) % numa_nodes.size();

0 commit comments

Comments
 (0)