Re: [PATCH] storage: kill dead stores

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

 



2010/7/30 Eric Blake <eblake@xxxxxxxxxx>:
> Found by clang.  Clang complained that virStorageBackendProbeTarget
> could dereference NULL if backingStoreFormat was NULL, but since all
> callers passed a valid pointer, I added attributes instead of null
> checks.
>
> * src/storage/storage_backend.c
> (virStorageBackendQEMUImgBackingFormat): Kill dead store.
> * src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
> Likewise.  Skip null checks, by adding attributes.
> ---
>
> Thankfully, the null dereference scenario noted by clang was never
> triggered in the code, which is good since it was introduced as
> part of fixing a CVE.
>
>  src/storage/storage_backend.c    |    3 +--
>  src/storage/storage_backend_fs.c |   34 +++++++++++++++-------------------
>  2 files changed, 16 insertions(+), 21 deletions(-)
>

> @@ -75,7 +73,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
>                                                       allocation,
>                                                       capacity)) < 0) {
>         close(fd);
> -        return -1;
> +        return ret;

Why do you return ret here? Doing so doesn't harm but it's not
necessary, virStorageBackendUpdateVolTargetInfoFD returns 0 or -1
only, in contrast to virStorageBackendVolOpenCheckMode that can return
0, -1 or -2.

ACK.

Matthias

--
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]