On 05/13/2015 04:55 AM, Ján Tomko wrote:
>>> Okay, I see your counterargument.  Still, strstr() is pretty expensive
>>> compared to just:
>>>
>>> if (def->bridge &&
>>>     (p = strchr(def->bridge, '%')) == strrchr(def->bridge, '%') &&
>>>     p[1] == 'd')
>>>
>>
>> Coverity complains :
>>
>> Event returned_null:         "strchr" returns null (checked 273 out of 288 
>> times).
> 
> strchr does not return NULL here because networkFindUnusedBridgeName is
> only called if either def->bridge is NULL or def->bridge contains "%d".

Adding "p &&" just before "p[1] == 'd'" should silence the false
positive, right?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to