On 2/25/22 18:29, Jeffrey Walton wrote:
>> @@ -270,7 +277,7 @@ static inline struct ofpbuf *ofpbuf_from_list(const
>> struct ovs_list *list)
>> static inline bool ofpbuf_equal(const struct ofpbuf *a, const struct ofpbuf
>> *b)
>> {
>> return a->size == b->size &&
>> - memcmp(a->data, b->data, a->size) == 0;
>> + (a->size == 0 || memcmp(a->data, b->data, a->size) == 0);
>> }
> Please forgive my ignorance... a != 0 and b == 0? Or can b never be 0?
>
a and b can't be zero at this point, otherwise we would've de-referenced
NULL in "a->size == b->size".
I guess I did it again, I used the fact that if a->size == b->size == 0
then we should assume that the ofpbuf 'a' and ofpbuf 'b' are equal,
equivalent to "empty" ofpbufs, regardless of values of 'a->data' and
b->data'.
But this change doesn't really belong in this patch, it should've been
part of 8ed26a8be3be ("treewide: Don't pass NULL to library functions
that expect non-NULL.").
I can split it out if needed and respin a v5 after v4 gets some reviews.
Thanks for pointing it out!
Regards,
Dumitru
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev