Skip to content
Closed
Prev Previous commit
Next Next commit
Ensure we are guarded against all cases where cacheSize == SIZE_MAX
  • Loading branch information
mrsharm authored and github-actions committed Apr 3, 2024
commit 6266af0043f7480bbd94c572c0a7fee6718d35a5
4 changes: 2 additions & 2 deletions src/coreclr/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
#endif

#if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_APPLE)
if (cacheSize == 0)
if (cacheSize == 0 || cacheSize == SIZE_MAX)
{
// We expect to get the L3 cache size for Arm64 but currently expected to be missing that info
// from most of the machines.
Expand Down Expand Up @@ -882,7 +882,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
#endif

#if HAVE_SYSCTLBYNAME
if (cacheSize == 0)
if (cacheSize == 0 || cacheSize == SIZE_MAX)
{
int64_t cacheSizeFromSysctl = 0;
size_t sz = sizeof(cacheSizeFromSysctl);
Expand Down