public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v2] linux: __get_nprocs_sched: initialize cpu_bits array with zeroes [BZ #28850]
Date: Tue, 01 Feb 2022 23:33:55 +0100	[thread overview]
Message-ID: <87a6fa2p4c.fsf@igel.home> (raw)
In-Reply-To: <20220201221407.500964-1-glebfm@altlinux.org> (Gleb Fotengauer-Malinovskiy's message of "Tue, 1 Feb 2022 22:14:07 +0000")

On Feb 01 2022, Gleb Fotengauer-Malinovskiy wrote:

> ---
>  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..b0a7663f56 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_set_t*) cpu_bits);
>    int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
>  				 cpu_bits);
>    if (r > 0)

r is the actual size of the cpu mask, which can conveniently be passed
to CPU_COUNT_S.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  parent reply	other threads:[~2022-02-01 22:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01 21:56 [PATCH] " Gleb Fotengauer-Malinovskiy
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 [this message]
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=87a6fa2p4c.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=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).