1ae00ffc06
Upstream commit: 6eaf10cbb78d22eae7999d9de55f6b93999e0860 - socket: Do not use AF_NETLINK in __opensock - hurd if_index: Explicitly use AF_INET for if index discovery - Linux: Simplify __opensock and fix race condition [BZ #28353] - linux: __get_nprocs_sched: do not feed CPU_COUNT_S with garbage [BZ #28850]
27 lines
1.1 KiB
Diff
27 lines
1.1 KiB
Diff
commit 05c83ccaf50aef2dd30d92cbb814383f6bddea2c
|
|
Author: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
|
|
Date: Tue Feb 1 22:39:02 2022 +0000
|
|
|
|
linux: __get_nprocs_sched: do not feed CPU_COUNT_S with garbage [BZ #28850]
|
|
|
|
Pass the actual number of bytes returned by the kernel.
|
|
|
|
Fixes: 33099d72e41c ("linux: Simplify get_nprocs")
|
|
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
(cherry picked from commit 97ba273b505763325efd802dc3a9562dbba79579)
|
|
|
|
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
|
|
index 7fc6521942e87293..7babd947aa902e77 100644
|
|
--- a/sysdeps/unix/sysv/linux/getsysstats.c
|
|
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
|
|
@@ -45,7 +45,7 @@ __get_nprocs_sched (void)
|
|
int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
|
|
cpu_bits);
|
|
if (r > 0)
|
|
- return CPU_COUNT_S (cpu_bits_size, (cpu_set_t*) cpu_bits);
|
|
+ return CPU_COUNT_S (r, (cpu_set_t*) cpu_bits);
|
|
else if (r == -EINVAL)
|
|
/* The input buffer is still not enough to store the number of cpus. This
|
|
is an arbitrary values assuming such systems should be rare and there
|