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

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

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 ==
    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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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