Skip to content
Merged
Prev Previous commit
Next Next commit
Ensure we are guarded against all cases where cacheSize == SIZE_MAX
  • Loading branch information
mrsharm committed Apr 1, 2024
commit 5868885759075c7843e55a5acb01db5c52440a4b
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 @@ -930,7 +930,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 @@ -958,7 +958,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