From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Hector Cao <hector.cao@canonical.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [PATCH] util/coroutine: trim sysctl's max_map_count newline before parsing
Date: Wed, 7 Oct 2026 08:16:34 +0100 [thread overview]
Message-ID: <asXx0kf7O0nOsBCX@redhat.com> (raw)
In-Reply-To: <20261006232018.211749-1-hector.cao@canonical.com>
On Wed, Oct 07, 2026 at 01:20:18AM +0200, Hector Cao wrote:
> Strip trailing whitespace from max_map_count before passing it to
> qemu_strtoi(), allowing the strict full-string parse to succeed.
> Otherwise, qemu_strtoi() fails to parse the string and returns -22,
> making the global cache pool cap size set to UINT_MAX.
>
> Fixes: 86a637e48104 ("coroutine: cap per-thread local pool size")
> Signed-off-by: Hector Cao <hector.cao@canonical.com>
> ---
> util/qemu-coroutine.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
> index d17135f585a..5af61995437 100644
> --- a/util/qemu-coroutine.c
> +++ b/util/qemu-coroutine.c
> @@ -374,8 +374,12 @@ static unsigned int get_global_pool_hard_max_size(void)
> * VMAs.
> */
> if (g_file_get_contents("/proc/sys/vm/max_map_count", &contents, NULL,
> - NULL) &&
> - qemu_strtoi(contents, NULL, 10, &max_map_count) == 0) {
> + NULL)) {
> + /* contents has trailing newline, remove it before conversion */
> + g_strchomp(contents);
> + if (qemu_strtoi(contents, NULL, 10, &max_map_count) != 0) {
> + return UINT_MAX;
> + }
> /*
> * This is an upper bound that avoids exceeding max_map_count. Leave a
> * fixed amount for non-coroutine users like library dependencies,
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
prev parent reply other threads:[~2026-10-07 9:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 23:20 [PATCH] util/coroutine: trim sysctl's max_map_count newline before parsing Hector Cao
2026-10-07 7:16 ` Daniel P. Berrangé [this message]
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=asXx0kf7O0nOsBCX@redhat.com \
--to=berrange@redhat.com \
--cc=hector.cao@canonical.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.