On 12/21/21 15:57, Aaron Conole wrote:
> Dumitru Ceara <[email protected]> writes:
> 
>> UB Sanitizer report:
>>   lib/stopwatch.c:119:22: runtime error: index 18446744073709551615 out of 
>> bounds for type 'long long unsigned int [50]'
>>       #0 0x698358 in calc_percentile lib/stopwatch.c:119
>>       #1 0x69ada1 in add_sample lib/stopwatch.c:231
>>       #2 0x69c086 in stopwatch_end_sample_protected lib/stopwatch.c:386
>>       #3 0x69c522 in stopwatch_thread lib/stopwatch.c:441
>>       #4 0x684bae in ovsthread_wrapper lib/ovs-thread.c:383
>>       #5 0x7f042838b298 in start_thread (/lib64/libpthread.so.0+0x9298)
>>       #6 0x7f04277f2352 in clone (/lib64/libc.so.6+0x100352)
>>
>> Signed-off-by: Dumitru Ceara <[email protected]>
>> ---
> 
> It's a good catch - even with the fixed qsort, the caculated percentiles
> are all incorrect.
> 
> I wonder if it also makes sense to have an early exit case in the
> calc_percentile function.  Either way, I think this makes a lot of sense
> to me.

We could add an early exit but given that because calc_percentile() is
static and called from a single place within stopwatch.c, just after we
validated that sw->n_samples > 0, I thought that's not really necessary.

> 
> Acked-by: Aaron Conole <[email protected]>
> 

Thanks for the review!

Dumitru

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to