diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/lib/gpr/cpu_linux.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/lib/gpr/cpu_linux.cc b/src/core/lib/gpr/cpu_linux.cc index fda28916f8..9fc2f0b141 100644 --- a/src/core/lib/gpr/cpu_linux.cc +++ b/src/core/lib/gpr/cpu_linux.cc @@ -71,6 +71,10 @@ unsigned gpr_cpu_current_cpu(void) { gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); return 0; } + if (static_cast<unsigned>(cpu) >= gpr_cpu_num_cores()) { + gpr_log(GPR_ERROR, "Cannot handle hot-plugged CPUs"); + return 0; + } return static_cast<unsigned>(cpu); #endif } |