Re: [PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_timecmp()

2021-08-18 Thread Alistair Francis
On Tue, Aug 17, 2021 at 6:00 PM Bin Meng wrote: > > On Tue, Aug 17, 2021 at 2:38 AM David Hoppenbrouwers > 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 immediat

Re: [PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_timecmp()

2021-08-17 Thread Bin Meng
On Tue, Aug 17, 2021 at 2:38 AM David Hoppenbrouwers 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 over

Re: [PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_timecmp()

2021-08-16 Thread Alistair Francis
On Tue, Aug 17, 2021 at 4:39 AM David Hoppenbrouwers 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 over

[PATCH v2] hw/intc/sifive_clint: Fix overflow in sifive_clint_write_timecmp()

2021-08-16 Thread David Hoppenbrouwers
`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 "infin