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

Re: [libvirt] [PATCH 3/5] virStorageBackendFileSystemMount: placate clang



Eric Blake wrote:
> On 04/14/2010 02:46 AM, Jim Meyering wrote:
>> From: Jim Meyering <meyering redhat com>
>>
>> * src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
>> Clang was not smart enough, and mistakenly reported that "options"
>> could be used uninitialized.  Initialize it.
>
> I had to convince myself of your claim that it cannot be used uninitialized:
>
>     int glusterfs = (pool->def->type == VIR_STORAGE_POOL_NETFS &&
>                  pool->def->source.format ==
> VIR_STORAGE_POOL_NETFS_GLUSTERFS);
> ...
>     if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
>         if (pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS) {
>             if (virAsprintf(&options, "direct-io-mode=1") == -1) {
> ...
>     if (glusterfs) {
>         mntargv[option_index] = options;
>     }
>
> Given 110 lines in between the declaration and the use, I agree with
> your patch to make our assertion obvious, even if we now have a dead
> store of NULL.  ACK.

Thanks.  All pushed.


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