[libvirt] [PATCH 3/5] virStorageBackendFileSystemMount: placate clang
Eric Blake
eblake at redhat.com
Wed Apr 14 14:21:26 UTC 2010
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.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100414/cd2337e8/attachment-0001.sig>
More information about the libvir-list
mailing list