[lvm-devel] [PATCH 15/23] Add test check for find_config_str

Zdenek Kabelac zkabelac at redhat.com
Wed Dec 22 10:00:41 UTC 2010


Dne 21.12.2010 18:32, Milan Broz napsal(a):
> On 12/21/2010 04:41 PM, Zdenek Kabelac wrote:
> 
>> -	*desc = dm_pool_strdup(mem, d);
>> +	*desc = (d) ? dm_pool_strdup(mem, d) : NULL;
> 
> dm_pool_strdup(NULL) tries to alloc 1 byte and returning pointer, 
> and not setting to \0 and calling strlen(NULL).

hmm libdm/mm/pool.c - line 30
It looks like fault case.


> 
> dunno what was the intention here.
> 
>> -	get_config_uint32(cft->root, "creation_time", &u);
>> +	(void) get_config_uint32(cft->root, "creation_time", &u);
> 
> What's wrong here? I thought that this is needed only
> if is defined with warn_if_unused_result?
> 

When we ignore return value - we should do that explicitly
when we test all other cases - it's being reported as suspicious.

IMHO more important question here is - if it's correct to have
this function returning void.

Zdenek






More information about the lvm-devel mailing list