public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
To: libc-alpha@sourceware.org
Subject: [PATCH] linux: __get_nprocs_sched: initialize cpu_bits array with zeroes [BZ #28850]
Date: Tue,  1 Feb 2022 21:56:44 +0000	[thread overview]
Message-ID: <20220201215644.473902-1-glebfm@altlinux.org> (raw)

---
 sysdeps/unix/sysv/linux/getsysstats.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
index 4798cc337e..5436bdb507 100644
--- a/sysdeps/unix/sysv/linux/getsysstats.c
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
@@ -41,6 +41,7 @@ __get_nprocs_sched (void)
 
   /* This cannot use malloc because it is used on malloc initialization.  */
   __cpu_mask cpu_bits[cpu_bits_size / sizeof (__cpu_mask)];
+  CPU_ZERO_S(cpu_bits_size, cpu_bits);
   int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
 				 cpu_bits);
   if (r > 0)
-- 
glebfm


             reply	other threads:[~2022-02-01 21:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 21:56 Gleb Fotengauer-Malinovskiy [this message]
2022-02-01 22:14 ` [PATCH v2] " Gleb Fotengauer-Malinovskiy
2022-02-01 22:22   ` Dmitry V. Levin
2022-02-01 22:33   ` Andreas Schwab
2022-02-01 22:44     ` [PATCH v3] linux: __get_nprocs_sched: do not feed CPU_COUNT_S with garbage " Gleb Fotengauer-Malinovskiy
2022-02-01 22:46       ` Dmitry V. Levin
2022-02-01 22:14 ` [PATCH] linux: __get_nprocs_sched: initialize cpu_bits array with zeroes " Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220201215644.473902-1-glebfm@altlinux.org \
    --to=glebfm@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).