[libvirt] [PATCHv2] Ignore bridge template names with multiple printf conversions

John Ferlan jferlan at redhat.com
Wed May 13 15:10:00 UTC 2015



On 05/13/2015 10:58 AM, Eric Blake wrote:
> 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?
> 

Yes.  I'll send something in a bit - there's another two that are queued
up as well.

John




More information about the libvir-list mailing list