[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_
From: |
Alistair Francis |
Subject: |
Re: [PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_timecmp() |
Date: |
Thu, 19 Aug 2021 10:13:41 +1000 |
On Tue, Aug 17, 2021 at 6:00 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Tue, Aug 17, 2021 at 2:38 AM David Hoppenbrouwers <david@salt-inc.org>
> wrote:
> >
> > `next` is an `uint64_t` value, but `timer_mod` takes an `int64_t`. This
> > resulted in high values such as `UINT64_MAX` being converted to `-1`,
> > which caused an immediate timer interrupt.
> >
> > By limiting `next` to `INT64_MAX` no overflow will happen while the
> > timer will still be effectively set to "infinitely" far in the future.
> >
> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/493
> > Signed-off-by: David Hoppenbrouwers <david@salt-inc.org>
> > ---
> > I wrongly used `MAX` instead of `MIN`. I've amended the patch.
> >
> > hw/intc/sifive_clint.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Thanks!
Applied to riscv-to-apply.next
Alistair
>