[PATCH v3 2/5] vhost: make use of FD manager init function

Maxime Coquelin maxime.coquelin at redhat.com
Wed Apr 10 08:22:27 CEST 2024



On 4/9/24 18:38, Stephen Hemminger wrote:
> On Tue,  9 Apr 2024 13:48:42 +0200
> Maxime Coquelin <maxime.coquelin at redhat.com> wrote:
> 
>> -void
>> +int
>>   fdset_init(struct fdset *pfdset)
>>   {
>>   	int i;
>>   
>>   	if (pfdset == NULL)
>> -		return;
>> +		return -1;
> 
> This test is unnecessary. The function is not exported, and therefore
> can only be called from vhost library. And all call sites are passing
> a pointer to local data.
> 
> Adding extra parameter checks to internal functions bloats code
> and creates lots of untestable paths. Coverity might even be
> smart enough to detect these.
> 

Agree. I will remove the test in next revision.

Thanks,
Maxime



More information about the dev mailing list