hw/char/riscv_htif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Use PRIx64 instead of %llx for uint64_t arguments to avoid
-Werror=format warnings on platforms where uint64_t is not
long long.
This fixes the cross-riscv64-system CI failure:
../hw/char/riscv_htif.c: In function 'htif_handle_tohost_write':
../hw/char/riscv_htif.c:175:38: error: format '%llx' expects argument
of type 'long long unsigned int', but argument 2 has type 'uint64_t'
{aka 'long unsigned int'} [-Werror=format=]
Fixes: d98f7a541c2c ("riscv_htif: reject invalid signature ranges (end <= begin)")
Tested-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
---
hw/char/riscv_htif.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index 65ddea3fc8..a53d2ace02 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -172,8 +172,9 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
*/
if (sig_file && begin_sig_addr && end_sig_addr) {
if (end_sig_addr <= begin_sig_addr) {
- error_report("Invalid HTIF signature range: begin=0x%llx end=0x%llx",
- begin_sig_addr, end_sig_addr);
+ error_report("Invalid HTIF signature range:"
+ " begin=0x%" PRIx64 " end=0x%" PRIx64,
+ begin_sig_addr, end_sig_addr);
return;
}
uint64_t sig_len = end_sig_addr - begin_sig_addr;
--
2.53.0
On Wed, Apr 15, 2026 at 11:51 PM Chao Liu <chao.liu.zevorn@gmail.com> wrote:
>
> Use PRIx64 instead of %llx for uint64_t arguments to avoid
> -Werror=format warnings on platforms where uint64_t is not
> long long.
>
> This fixes the cross-riscv64-system CI failure:
>
> ../hw/char/riscv_htif.c: In function 'htif_handle_tohost_write':
> ../hw/char/riscv_htif.c:175:38: error: format '%llx' expects argument
> of type 'long long unsigned int', but argument 2 has type 'uint64_t'
> {aka 'long unsigned int'} [-Werror=format=]
>
> Fixes: d98f7a541c2c ("riscv_htif: reject invalid signature ranges (end <= begin)")
> Tested-by: Tao Tang <tangtao1634@phytium.com.cn>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Again, is it ok if I squash this patch with "reject invalid signature
ranges (end <= begin)" to maintain bisectability?
Alistair
On Thu, Apr 16, 2026 at 01:50:39PM +1000, Alistair Francis wrote:
> On Wed, Apr 15, 2026 at 11:51 PM Chao Liu <chao.liu.zevorn@gmail.com> wrote:
> >
> > Use PRIx64 instead of %llx for uint64_t arguments to avoid
> > -Werror=format warnings on platforms where uint64_t is not
> > long long.
> >
> > This fixes the cross-riscv64-system CI failure:
> >
> > ../hw/char/riscv_htif.c: In function 'htif_handle_tohost_write':
> > ../hw/char/riscv_htif.c:175:38: error: format '%llx' expects argument
> > of type 'long long unsigned int', but argument 2 has type 'uint64_t'
> > {aka 'long unsigned int'} [-Werror=format=]
> >
> > Fixes: d98f7a541c2c ("riscv_htif: reject invalid signature ranges (end <= begin)")
> > Tested-by: Tao Tang <tangtao1634@phytium.com.cn>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> > Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
>
> Again, is it ok if I squash this patch with "reject invalid signature
> ranges (end <= begin)" to maintain bisectability?
Agreed, this is a good idea.
Thanks,
Chao
>
> Alistair
Sounds good to me, thanks.
On Thu, Apr 16, 2026 at 2:09 PM Chao Liu <chao.liu.zevorn@gmail.com> wrote:
> On Thu, Apr 16, 2026 at 01:50:39PM +1000, Alistair Francis wrote:
> > On Wed, Apr 15, 2026 at 11:51 PM Chao Liu <chao.liu.zevorn@gmail.com>
> wrote:
> > >
> > > Use PRIx64 instead of %llx for uint64_t arguments to avoid
> > > -Werror=format warnings on platforms where uint64_t is not
> > > long long.
> > >
> > > This fixes the cross-riscv64-system CI failure:
> > >
> > > ../hw/char/riscv_htif.c: In function 'htif_handle_tohost_write':
> > > ../hw/char/riscv_htif.c:175:38: error: format '%llx' expects argument
> > > of type 'long long unsigned int', but argument 2 has type 'uint64_t'
> > > {aka 'long unsigned int'} [-Werror=format=]
> > >
> > > Fixes: d98f7a541c2c ("riscv_htif: reject invalid signature ranges (end
> <= begin)")
> > > Tested-by: Tao Tang <tangtao1634@phytium.com.cn>
> > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> > > Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> > > Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
> >
> > Again, is it ok if I squash this patch with "reject invalid signature
> > ranges (end <= begin)" to maintain bisectability?
> Agreed, this is a good idea.
>
> Thanks,
> Chao
>
> >
> > Alistair
>
On Wed, Apr 15, 2026 at 11:51 PM Chao Liu <chao.liu.zevorn@gmail.com> wrote:
>
> Use PRIx64 instead of %llx for uint64_t arguments to avoid
> -Werror=format warnings on platforms where uint64_t is not
> long long.
>
> This fixes the cross-riscv64-system CI failure:
>
> ../hw/char/riscv_htif.c: In function 'htif_handle_tohost_write':
> ../hw/char/riscv_htif.c:175:38: error: format '%llx' expects argument
> of type 'long long unsigned int', but argument 2 has type 'uint64_t'
> {aka 'long unsigned int'} [-Werror=format=]
>
> Fixes: d98f7a541c2c ("riscv_htif: reject invalid signature ranges (end <= begin)")
> Tested-by: Tao Tang <tangtao1634@phytium.com.cn>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
> ---
> hw/char/riscv_htif.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
> index 65ddea3fc8..a53d2ace02 100644
> --- a/hw/char/riscv_htif.c
> +++ b/hw/char/riscv_htif.c
> @@ -172,8 +172,9 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
> */
> if (sig_file && begin_sig_addr && end_sig_addr) {
> if (end_sig_addr <= begin_sig_addr) {
> - error_report("Invalid HTIF signature range: begin=0x%llx end=0x%llx",
> - begin_sig_addr, end_sig_addr);
> + error_report("Invalid HTIF signature range:"
> + " begin=0x%" PRIx64 " end=0x%" PRIx64,
> + begin_sig_addr, end_sig_addr);
> return;
> }
> uint64_t sig_len = end_sig_addr - begin_sig_addr;
> --
> 2.53.0
>
>
© 2016 - 2026 Red Hat, Inc.