Skip to content

Commit

Permalink
fix coverity issue in tbbmalloc HugePagesStatus
Browse files Browse the repository at this point in the history
page_size variable was set to -1024 if hugepages was not used, while
being unsigned type. It did not matter as it was not used, when
hugepages are not used, but it is better to set it just to 0.
  • Loading branch information
lplewa authored and KFilipek committed Aug 26, 2024
1 parent aae7fa6 commit 374c27d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tbbmalloc/tbbmalloc_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ class HugePagesStatus {
MALLOC_ASSERT(!pageSize, "Huge page size can't be set twice. Double initialization.");

// Initialize object variables
pageSize = hugePageSize * 1024; // was read in KB from meminfo
if (hugePageSize > -1) {
pageSize = hugePageSize * 1024; // was read in KB from meminfo
} else {
pageSize = 0;
}
isHPAvailable = hpAvailable;
isTHPAvailable = thpAvailable;
}
Expand Down

0 comments on commit 374c27d

Please sign in to comment.