[libvirt] [PATCH 1/4] qemu: domain: gfx: Fix shadowing the ptr argument to graphics validation

Erik Skultety posted 4 patches 7 years, 2 months ago
[libvirt] [PATCH 1/4] qemu: domain: gfx: Fix shadowing the ptr argument to graphics validation
Posted by Erik Skultety 7 years, 2 months ago
Since the code was never run, this stupid mistake could have only been
spotted by an accident.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/qemu/qemu_domain.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 509da6bfea..1eb0e31df0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5783,9 +5783,7 @@ qemuDomainDeviceDefValidateGraphics(const virDomainGraphicsDef *graphics,
     size_t i;
 
     for (i = 0; i < def->ngraphics; i++) {
-        graphics = def->graphics[i];
-
-        if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) {
+        if (def->graphics[i]->type == VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS) {
             have_egl_headless = true;
             break;
         }
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] qemu: domain: gfx: Fix shadowing the ptr argument to graphics validation
Posted by John Ferlan 7 years, 1 month ago

On 12/7/18 9:47 AM, Erik Skultety wrote:
> Since the code was never run, this stupid mistake could have only been
> spotted by an accident.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/qemu/qemu_domain.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 

Gah - that wasn't obvious... and it's scary the compiler was silent.

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] qemu: domain: gfx: Fix shadowing the ptr argument to graphics validation
Posted by Erik Skultety 7 years, 1 month ago
On Tue, Dec 11, 2018 at 06:48:26PM -0500, John Ferlan wrote:
>
>
> On 12/7/18 9:47 AM, Erik Skultety wrote:
> > Since the code was never run, this stupid mistake could have only been
> > spotted by an accident.
> >
> > Signed-off-by: Erik Skultety <eskultet@redhat.com>
> > ---
> >  src/qemu/qemu_domain.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
>
> Gah - that wasn't obvious... and it's scary the compiler was silent.

Indeed it is. I'm just wondering when would I actually want to use this
legitimately since it's perfectly fine to assign into a "copy" pointer from
the standard's point of view.

Thanks,
Erik

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