* [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL
@ 2018-05-15 18:58 Peter Maydell
2018-05-15 20:51 ` Philippe Mathieu-Daudé
2018-05-18 7:04 ` Gerd Hoffmann
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2018-05-15 18:58 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, Gerd Hoffmann, Anatoly Trosinenko
In commit 2ab858c6c38ee1 we added a use of the 'surf' variable
in sdl2_2d_update() that was unfortunately placed above the
early-exit-if-NULL check. Move it to where it ought to be.
Fixes: Coverity CID 1390598
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
ui/sdl2-2d.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
index 1f34817bae..85484407be 100644
--- a/ui/sdl2-2d.c
+++ b/ui/sdl2-2d.c
@@ -36,9 +36,7 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
DisplaySurface *surf = qemu_console_surface(dcl->con);
SDL_Rect rect;
- size_t surface_data_offset = surface_bytes_per_pixel(surf) * x +
- surface_stride(surf) * y;
-
+ size_t surface_data_offset;
assert(!scon->opengl);
if (!surf) {
@@ -48,6 +46,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
return;
}
+ surface_data_offset = surface_bytes_per_pixel(surf) * x +
+ surface_stride(surf) * y;
rect.x = x;
rect.y = y;
rect.w = w;
--
2.17.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL
2018-05-15 18:58 [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL Peter Maydell
@ 2018-05-15 20:51 ` Philippe Mathieu-Daudé
2018-05-18 7:04 ` Gerd Hoffmann
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-05-15 20:51 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Anatoly Trosinenko, Gerd Hoffmann, patches
On 05/15/2018 03:58 PM, Peter Maydell wrote:
> In commit 2ab858c6c38ee1 we added a use of the 'surf' variable
> in sdl2_2d_update() that was unfortunately placed above the
> early-exit-if-NULL check. Move it to where it ought to be.
>
> Fixes: Coverity CID 1390598
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> ui/sdl2-2d.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c
> index 1f34817bae..85484407be 100644
> --- a/ui/sdl2-2d.c
> +++ b/ui/sdl2-2d.c
> @@ -36,9 +36,7 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
> struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
> DisplaySurface *surf = qemu_console_surface(dcl->con);
> SDL_Rect rect;
> - size_t surface_data_offset = surface_bytes_per_pixel(surf) * x +
> - surface_stride(surf) * y;
> -
> + size_t surface_data_offset;
> assert(!scon->opengl);
>
> if (!surf) {
> @@ -48,6 +46,8 @@ void sdl2_2d_update(DisplayChangeListener *dcl,
> return;
> }
>
> + surface_data_offset = surface_bytes_per_pixel(surf) * x +
> + surface_stride(surf) * y;
> rect.x = x;
> rect.y = y;
> rect.w = w;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL
2018-05-15 18:58 [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL Peter Maydell
2018-05-15 20:51 ` Philippe Mathieu-Daudé
@ 2018-05-18 7:04 ` Gerd Hoffmann
2018-05-18 8:20 ` Anatoly Trosinenko
1 sibling, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2018-05-18 7:04 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches, Anatoly Trosinenko
On Tue, May 15, 2018 at 07:58:14PM +0100, Peter Maydell wrote:
> In commit 2ab858c6c38ee1 we added a use of the 'surf' variable
> in sdl2_2d_update() that was unfortunately placed above the
> early-exit-if-NULL check. Move it to where it ought to be.
Added to ui patch queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL
2018-05-18 7:04 ` Gerd Hoffmann
@ 2018-05-18 8:20 ` Anatoly Trosinenko
0 siblings, 0 replies; 4+ messages in thread
From: Anatoly Trosinenko @ 2018-05-18 8:20 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: Peter Maydell, qemu-devel, patches
Please excuse me and thank you very much for the fix!
2018-05-18 10:04 GMT+03:00 Gerd Hoffmann <kraxel@redhat.com>:
> On Tue, May 15, 2018 at 07:58:14PM +0100, Peter Maydell wrote:
> > In commit 2ab858c6c38ee1 we added a use of the 'surf' variable
> > in sdl2_2d_update() that was unfortunately placed above the
> > early-exit-if-NULL check. Move it to where it ought to be.
>
> Added to ui patch queue.
>
> thanks,
> Gerd
>
>
--
Anatoly <anatoly.trosinenko@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-18 8:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 18:58 [Qemu-devel] [PATCH] sdl: Move use of surface pointer below check for whether it is NULL Peter Maydell
2018-05-15 20:51 ` Philippe Mathieu-Daudé
2018-05-18 7:04 ` Gerd Hoffmann
2018-05-18 8:20 ` Anatoly Trosinenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.