Re: [PATCH] hw/timer: fix int underflow

2025-01-14 Thread Peter Maydell
On Tue, 14 Jan 2025 at 10:40, Paolo Bonzini wrote: > > On 1/14/25 11:14, Peter Maydell wrote: > >> So, to my opinion, explicit cast to "long long" is necessary > >> here to get the expected behavior. > > > > I wasn't saying the existing code was necessarily correct, > > or that your proposed chang

Re: [PATCH] hw/timer: fix int underflow

2025-01-14 Thread Paolo Bonzini
On 1/14/25 11:14, Peter Maydell wrote: So, to my opinion, explicit cast to "long long" is necessary here to get the expected behavior. I wasn't saying the existing code was necessarily correct, or that your proposed change was necessarily wrong. I was saying your patch didn't come with any anal

Re: [PATCH] hw/timer: fix int underflow

2025-01-14 Thread Peter Maydell
On Tue, 14 Jan 2025 at 06:41, Дмитрий Фролов wrote: > > Hello, Peter. > I beg a pardon, but I guess, we have a misunderstanding here. > > The problem is that comparison "if (limit < 0)" will never > be true. Thus, "true" branch is unreachable. According to > the comment below, it was assumed that

Re: [PATCH] hw/timer: fix int underflow

2025-01-13 Thread Дмитрий Фролов
Hello, Peter. I beg a pardon, but I guess, we have a misunderstanding here. The problem is that comparison "if (limit < 0)" will never be true. Thus, "true" branch is unreachable. According to the comment below, it was assumed that "limit" may be negative, and this means, that "QEMU is running to

Re: [PATCH] hw/timer: fix int underflow

2024-12-02 Thread Peter Maydell
On Wed, 6 Nov 2024 at 10:41, Dmitry Frolov wrote: > > Both timeout and return value of imx_gpt_update_count() are unsigned. > Thus "limit" can not be negative, but obviously it was implied. For changes to device models, you need to look at the data sheet for the device to determine the correct be

Re: [PATCH] hw/timer: fix int underflow

2024-11-26 Thread Дмитрий Фролов
Hi, Phil. On 26.11.2024 11:39, Philippe Mathieu-Daudé wrote: Hi Dmitry, On 6/11/24 11:40, Dmitry Frolov wrote: Both timeout and return value of imx_gpt_update_count() are unsigned. Thus "limit" can not be negative, but obviously it was implied. Found by Linux Verification Center (linuxtesting

Re: [PATCH] hw/timer: fix int underflow

2024-11-26 Thread Philippe Mathieu-Daudé
Hi Dmitry, On 6/11/24 11:40, Dmitry Frolov wrote: Both timeout and return value of imx_gpt_update_count() are unsigned. Thus "limit" can not be negative, but obviously it was implied. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov --- hw/timer

Re: [PATCH] hw/timer: fix int underflow

2024-11-25 Thread Дмитрий Фролов
ping

[PATCH] hw/timer: fix int underflow

2024-11-25 Thread Дмитрий Фролов
ping

[PATCH] hw/timer: fix int underflow

2024-11-06 Thread Dmitry Frolov
Both timeout and return value of imx_gpt_update_count() are unsigned. Thus "limit" can not be negative, but obviously it was implied. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov --- hw/timer/imx_gpt.c | 2 +- 1 file changed, 1 insertion(+), 1 d