From: "Michael S. Tsirkin" <mst@redhat.com>
To: Anton Kuchin <antonkuchin@nebius.com>
Cc: qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>,
Ani Sinha <anisinha@redhat.com>,
NB-CoreTeam@nebius.com
Subject: Re: [PATCH 2/2] hw/acpi/aml-build: Avoid overflow when advancing the free_base cursor
Date: Tue, 17 Nov 2026 07:20:08 -0500 [thread overview]
Message-ID: <20261117071926-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20261107-users-antonkuchin-to-send-fix-crs-replace-with-free-ranges-v1-2-0cede42456c4@nebius.com>
On Sat, Nov 07, 2026 at 12:59:49AM +0100, Anton Kuchin wrote:
> crs_replace_with_free_ranges() advances its cursor past each used
> range by adding one to the range's limit. If the limit is
> UINT64_MAX,
when is it UINT64_MAX?
> the cursor wraps to zero, potentially producing free
> ranges outside the requested window or overlapping used resources.
>
> Adjust free_base and stop processing when a used range reaches or
> exceeds the interval's upper bound to avoid cursor wrapping and
> final free range insertion.
was this tested? how?
>
> Signed-off-by: Anton Kuchin <antonkuchin@nebius.com>
> ---
> hw/acpi/aml-build.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index 90837b513e69..b71d82b5e8a9 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -154,6 +154,12 @@ void crs_replace_with_free_ranges(GPtrArray *ranges,
> crs_range_insert(free_ranges, free_base, used->base - 1);
> }
>
> + /* avoid free_base overflow when used->limit equals UINT64_MAX */
> + if (used->limit >= end) {
> + free_base = end;
> + break;
> + }
> +
> free_base = used->limit + 1;
> }
>
>
> --
> 2.43.0
next prev parent reply other threads:[~2026-11-17 12:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 23:59 [PATCH 0/2] hw/acpi/aml-build: Fix free ranges calculation in crs_replace_with_free_ranges() Anton Kuchin
2026-11-06 23:59 ` [PATCH 1/2] hw/acpi/aml-build: Ignore used ranges outside the requested window Anton Kuchin
2026-11-17 12:19 ` Michael S. Tsirkin
2026-11-17 12:28 ` Michael S. Tsirkin
2026-11-06 23:59 ` [PATCH 2/2] hw/acpi/aml-build: Avoid overflow when advancing the free_base cursor Anton Kuchin
2026-11-17 12:20 ` Michael S. Tsirkin [this message]
2026-11-17 12:21 ` [PATCH 0/2] hw/acpi/aml-build: Fix free ranges calculation in crs_replace_with_free_ranges() Michael S. Tsirkin
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=20261117071926-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=NB-CoreTeam@nebius.com \
--cc=anisinha@redhat.com \
--cc=antonkuchin@nebius.com \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.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 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.