Re: [PATCHv2] Ignore bridge template names with multiple printf conversions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]