From 68d11f88e9109138e7499b030a0cc151444bd7e4 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 27 Jul 2019 13:51:46 -0400 Subject: [PATCH] kernel/system_info: Check bounded "count" instead of the unbounded one. This condition should never be hit by well-behaved applications anyways. --- src/system/kernel/system_info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/system_info.cpp b/src/system/kernel/system_info.cpp index ea181f630e..71e27ec273 100644 --- a/src/system/kernel/system_info.cpp +++ b/src/system/kernel/system_info.cpp @@ -495,10 +495,10 @@ get_cpu_info(uint32 firstCPU, uint32 cpuCount, cpu_info* info) { if (firstCPU >= (uint32)smp_get_num_cpus()) return B_BAD_VALUE; - if (cpuCount == 0) - return B_OK; uint32 count = std::min(cpuCount, smp_get_num_cpus() - firstCPU); + if (count <= 0) + return B_OK; // This function is called very often from userland by applications // that display CPU usage information, so we want to keep this as