[libvirt] [PATCH 5/9] util: storagefile: Tolerate NULL path when looking up volume in chain

Peter Krempa posted 9 patches 7 years, 7 months ago
[libvirt] [PATCH 5/9] util: storagefile: Tolerate NULL path when looking up volume in chain
Posted by Peter Krempa 7 years, 7 months ago
chain->path may be NULL e.g. for NDB drives, so the check needs to avoid
dereferencing the path in such case
---
 src/util/virstoragefile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 9568a5068..818a679de 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1610,7 +1610,7 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
                 break;
         } else {
             if (STREQ_NULLABLE(name, chain->relPath) ||
-                STREQ(name, chain->path))
+                STREQ_NULLABLE(name, chain->path))
                 break;

             if (nameIsFile && virStorageSourceIsLocalStorage(chain)) {
-- 
2.14.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 5/9] util: storagefile: Tolerate NULL path when looking up volume in chain
Posted by Eric Blake 7 years, 7 months ago
On 10/12/2017 02:07 PM, Peter Krempa wrote:
> chain->path may be NULL e.g. for NDB drives, so the check needs to avoid

s/NDB/NBD/ ?

> dereferencing the path in such case
> ---
>  src/util/virstoragefile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 9568a5068..818a679de 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -1610,7 +1610,7 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
>                  break;
>          } else {
>              if (STREQ_NULLABLE(name, chain->relPath) ||
> -                STREQ(name, chain->path))
> +                STREQ_NULLABLE(name, chain->path))
>                  break;
> 
>              if (nameIsFile && virStorageSourceIsLocalStorage(chain)) {
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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