Re: [Qemu-devel] [PATCH 1/7] bt-sdp: fix broken uuids power-of-2 calculation

2015-03-17 Thread Eric Blake
On 03/17/2015 05:56 AM, Stefan Hajnoczi wrote: > The binary search in sdp_uuid_match() only works when the number of > elements to search is a power of two. > > lo = record->uuid; > hi = record->uuids; > while (hi >>= 1) > if (lo[hi] <= val) > lo += hi; > > return *lo == v

[Qemu-devel] [PATCH 1/7] bt-sdp: fix broken uuids power-of-2 calculation

2015-03-17 Thread Stefan Hajnoczi
The binary search in sdp_uuid_match() only works when the number of elements to search is a power of two. lo = record->uuid; hi = record->uuids; while (hi >>= 1) if (lo[hi] <= val) lo += hi; return *lo == val; I noticed that the record->uuids calculation in sdp_service_re