From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 3/3] sdl: Move use of surface pointer below check for whether it is NULL
Date: Fri, 18 May 2018 09:40:52 +0200 [thread overview]
Message-ID: <20180518074052.31724-4-kraxel@redhat.com> (raw)
In-Reply-To: <20180518074052.31724-1-kraxel@redhat.com>
From: Peter Maydell <peter.maydell@linaro.org>
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>
Message-id: 20180515185814.1374-1-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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.9.3
next prev parent reply other threads:[~2018-05-18 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 7:40 [Qemu-devel] [PULL 0/3] Ui 20180518 patches Gerd Hoffmann
2018-05-18 7:40 ` [Qemu-devel] [PULL 1/3] console: Avoid segfault in screendump Gerd Hoffmann
2018-05-18 7:40 ` [Qemu-devel] [PULL 2/3] ui: add x_keymap.o to modules Gerd Hoffmann
2018-05-18 7:40 ` Gerd Hoffmann [this message]
2018-05-18 11:58 ` [Qemu-devel] [PULL 0/3] Ui 20180518 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180518074052.31724-4-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).