On 11 Dec 2024, at 17:49, Ilya Maximets wrote:

> On 12/11/24 17:33, Eelco Chaudron wrote:
>> This function, in its current implementation, always returns a
>> negative value. The issue lies in the calculation: src represents
>> the original number of elements, while datum->n indicates the new
>> number of elements. Since datum->n is always greater than or equal
>> to src, reversing their order resolves the problem, ensuring the
>> function consistently returns a positive value.
>>
>> It’s worth noting that the return value is not currently utilized
>> in any of the function's use cases
>>
>> Signed-off-by: Eelco Chaudron <[email protected]>
>> ---
>>  lib/ovsdb-data.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
>> index abb923ad8..aadac6bb2 100644
>> --- a/lib/ovsdb-data.c
>> +++ b/lib/ovsdb-data.c
>> @@ -1230,7 +1230,7 @@ ovsdb_datum_sort_unique(struct ovsdb_datum *datum,
>>          }
>>      }
>>      datum->n = dst;
>> -    return datum->n - src;
>> +    return src - datum->n;
>>  }
>>
>>  /* Checks that each of the atoms in 'datum' conforms to the constraints
>
> Thanks!
>
> Acked-by: Ilya Maximets <[email protected]>

Thanks for the review Ilya and Mike. The patch was applied to main!

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

Reply via email to