xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Jiqian Chen <Jiqian.Chen@amd.com>, xen-devel@lists.xenproject.org
Cc: Huang Rui <ray.huang@amd.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH 1/1] tools/libs/light: fix BAR memory address truncation
Date: Mon, 13 Oct 2025 09:40:59 +0200	[thread overview]
Message-ID: <023e9bb5-85f7-4080-929d-8d3b07f89a24@gmail.com> (raw)
In-Reply-To: <20251010080029.29328-1-Jiqian.Chen@amd.com>

[-- Attachment #1: Type: text/plain, Size: 2604 bytes --]


On 10/10/25 10:00 AM, Jiqian Chen wrote:
> 64-bit BAR memory address is truncated when removing a passthrough pci
> device from guest since it uses "unsigned int".
>
> So, change to use "unsigned long long" to fix this problem.
>
> Signed-off-by: Jiqian Chen<Jiqian.Chen@amd.com>
> ---
> cc: Anthony PERARD<anthony.perard@vates.tech>
> cc: Juergen Gross<jgross@suse.com>
> cc: Oleksii Kurochko<oleksii.kurochko@gmail.com>
> ---
>   tools/libs/light/libxl_pci.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)

With getting proper Ack(s) from maintainers, the patch could be considered
to be in 4.21:
  Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

>
> diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
> index 2ea2caeb6624..88ffbbf08abe 100644
> --- a/tools/libs/light/libxl_pci.c
> +++ b/tools/libs/light/libxl_pci.c
> @@ -2001,7 +2001,8 @@ static void pci_remove_detached(libxl__egc *egc,
>   {
>       STATE_AO_GC(prs->aodev->ao);
>       libxl_ctx *ctx = libxl__gc_owner(gc);
> -    unsigned int start = 0, end = 0, flags = 0, size = 0, irq = 0;
> +    unsigned long long start = 0, end = 0, flags = 0, size = 0;
> +    unsigned int irq = 0;
>       int i, stubdomid = 0;
>       const char *sysfs_path;
>       FILE *f;
> @@ -2031,7 +2032,7 @@ static void pci_remove_detached(libxl__egc *egc,
>       }
>   
>       for (i = 0; i < PROC_PCI_NUM_RESOURCES; i++) {
> -        if (fscanf(f, "0x%x 0x%x 0x%x\n", &start, &end, &flags) != 3)
> +        if (fscanf(f, "0x%llx 0x%llx 0x%llx\n", &start, &end, &flags) != 3)
>               continue;
>           size = end - start + 1;
>           if (start) {
> @@ -2040,7 +2041,7 @@ static void pci_remove_detached(libxl__egc *egc,
>                                                    size, 0);
>                   if (rc < 0)
>                       LOGED(ERROR, domid,
> -                          "xc_domain_ioport_permission error 0x%x/0x%x",
> +                          "xc_domain_ioport_permission error 0x%llx/0x%llx",
>                             start,
>                             size);
>               } else {
> @@ -2050,7 +2051,7 @@ static void pci_remove_detached(libxl__egc *egc,
>                                                   0);
>                   if (rc < 0)
>                       LOGED(ERROR, domid,
> -                          "xc_domain_iomem_permission error 0x%x/0x%x",
> +                          "xc_domain_iomem_permission error 0x%llx/0x%llx",
>                             start,
>                             size);
>               }

[-- Attachment #2: Type: text/html, Size: 3454 bytes --]

      parent reply	other threads:[~2025-10-13  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-10  8:00 [PATCH 1/1] tools/libs/light: fix BAR memory address truncation Jiqian Chen
2025-10-10  8:19 ` Jan Beulich
2025-10-10  9:02   ` Jürgen Groß
2025-10-10  8:21 ` Jan Beulich
2025-10-13  7:40 ` Oleksii Kurochko [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=023e9bb5-85f7-4080-929d-8d3b07f89a24@gmail.com \
    --to=oleksii.kurochko@gmail.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=anthony.perard@vates.tech \
    --cc=jgross@suse.com \
    --cc=ray.huang@amd.com \
    --cc=xen-devel@lists.xenproject.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 NNTP newsgroup(s).