Re: [PATCH] sbi: mpxy: define INVALID_ADDR using unsigned long width

Anup Patel <[email protected]>
Newsgroups org.infradead.lists.opensbi
Message-ID <CAK9=C2U0RUqjSN4qJpEvUQ5A4nTDRkDeu_4Ta6_mCj31Uq-rHQ@mail.gmail.com>
On Thu, May 21, 2026 at 10:59 AM Himanshu Chauhan
<[email protected]> wrote:
>
> INVALID_ADDR is used as an all-ones physical address sentinel.
> Using -1U only guarantees 32-bit width, so on platforms where
> unsigned long is wider it may not expand to all ones after assignment.
>
> Use -1ULL so the conversion to unsigned long preserves an all-ones
> bit pattern across supported widths.
>
> Fixes: 7939bf1329eb ("lib: sbi: Add SBI Message Proxy (MPXY) framework")
> Signed-off-by: Himanshu Chauhan <[email protected]>

This is critical fix hence merging it quickly.

Reviewed-by: Anup Patel <[email protected]>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/sbi/sbi_mpxy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_mpxy.c b/lib/sbi/sbi_mpxy.c
> index a83cf16c..79851097 100644
> --- a/lib/sbi/sbi_mpxy.c
> +++ b/lib/sbi/sbi_mpxy.c
> @@ -28,7 +28,7 @@ static unsigned long mpxy_shmem_size = PAGE_SIZE;
>  static SBI_LIST_HEAD(mpxy_channel_list);
>
>  /** Invalid Physical Address(all bits 1) */
> -#define INVALID_ADDR           (-1U)
> +#define INVALID_ADDR           (-1ULL)
>
>  /** MPXY Attribute size in bytes */
>  #define ATTR_SIZE              (4)
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/opensbi

-- 
opensbi mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/opensbi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.