Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-17 Thread Daniel P . Berrangé
On Tue, Jul 15, 2025 at 09:45:51AM -0300, Fabiano Rosas wrote: > Coverity has caught a bug in the formatting of time intervals for > postcopy latency distribution display in 'info migrate'. > > While bounds checking the labels array, sizeof is incorrectly being > used. ARRAY_SIZE is the correct fo

Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-17 Thread Fabiano Rosas
Prasad Pandit writes: > On Wed, 16 Jul 2025 at 19:06, Fabiano Rosas wrote: >> The condition should be >=. > > * I'm thinking of doing away with the loop and the string array. The > array has 3 values of which only one gets used due to conversion to > seconds. The point is not to convert to seco

Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-16 Thread Prasad Pandit
On Wed, 16 Jul 2025 at 19:06, Fabiano Rosas wrote: > The condition should be >=. * I'm thinking of doing away with the loop and the string array. The array has 3 values of which only one gets used due to conversion to seconds. > But then that's "0 sec" for 100 us. #define US (MS * 1000) =>

Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-16 Thread Fabiano Rosas
Prasad Pandit writes: > On Tue, 15 Jul 2025 at 18:49, Fabiano Rosas wrote: >> @@ -57,11 +57,9 @@ static const gchar *format_time_str(uint64_t us) >> const char *units[] = {"us", "ms", "sec"}; >> int index = 0; >> >> -while (us > 1000) { >> +while (us > 1000 && index + 1 < ARRAY

Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-16 Thread Prasad Pandit
On Tue, 15 Jul 2025 at 18:49, Fabiano Rosas wrote: > @@ -57,11 +57,9 @@ static const gchar *format_time_str(uint64_t us) > const char *units[] = {"us", "ms", "sec"}; > int index = 0; > > -while (us > 1000) { > +while (us > 1000 && index + 1 < ARRAY_SIZE(units)) { > us /=

Re: [PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-15 Thread Philippe Mathieu-Daudé
On 15/7/25 14:45, Fabiano Rosas wrote: Coverity has caught a bug in the formatting of time intervals for postcopy latency distribution display in 'info migrate'. While bounds checking the labels array, sizeof is incorrectly being used. ARRAY_SIZE is the correct form of obtaining the size of an a

[PATCH 1/2] migration: Fix postcopy latency distribution formatting computation

2025-07-15 Thread Fabiano Rosas
Coverity has caught a bug in the formatting of time intervals for postcopy latency distribution display in 'info migrate'. While bounds checking the labels array, sizeof is incorrectly being used. ARRAY_SIZE is the correct form of obtaining the size of an array. Fixes: 3345fb3b6d ("migration/post