[libvirt] [PATCH 3/5] virStorageBackendFileSystemMount: placate clang
Jim Meyering
jim at meyering.net
Wed Apr 14 15:36:24 UTC 2010
Eric Blake wrote:
> On 04/14/2010 02:46 AM, Jim Meyering wrote:
>> From: Jim Meyering <meyering at 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.
More information about the libvir-list
mailing list