Re: [PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer

2024-09-01 Thread Richard Henderson
On 9/2/24 07:34, Richard Henderson wrote: @@ -158,7 +158,7 @@ static uint64_t m5208_sys_read(void *opaque, hwaddr addr,   {   int n;   for (n = 0; n < 32; n++) { -    if (current_machine->ram_size < (2u << n)) { +    if (current_machine->ram

Re: [PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer

2024-09-01 Thread Richard Henderson
On 8/31/24 03:34, Peter Maydell wrote: In m5208_sys_read(), we have a loop of n from 0 to 31, and we calculate (2u << n). For the n == 31 iteration this will shift off the top of the unsigned 32 bit integer. This is harmless, because we're going to stop the loop with n == 31 anyway, but we can

Re: [PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer

2024-08-30 Thread Thomas Huth
Am Fri, 30 Aug 2024 18:34:50 +0100 schrieb Peter Maydell : > In m5208_sys_read(), we have a loop of n from 0 to 31, and we > calculate (2u << n). For the n == 31 iteration this will shift off > the top of the unsigned 32 bit integer. > > This is harmless, because we're going to stop the loop wit

[PATCH 1/3] hw/m68k/mcf5208: Avoid shifting off end of integer

2024-08-30 Thread Peter Maydell
In m5208_sys_read(), we have a loop of n from 0 to 31, and we calculate (2u << n). For the n == 31 iteration this will shift off the top of the unsigned 32 bit integer. This is harmless, because we're going to stop the loop with n == 31 anyway, but we can avoid the error by using 64-bit arithmeti