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

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

 



On 04/14/2010 02:46 AM, Jim Meyering wrote:
> From: Jim Meyering <meyering@xxxxxxxxxx>
> 
> * 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.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]