From: AlexChen <alex.chen@huawei.com>
To: <peter.maydell@linaro.org>
Cc: <qemu-arm@nongnu.org>, QEMU <qemu-devel@nongnu.org>,
<qemu-trivial@nongnu.org>
Subject: [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference
Date: Fri, 30 Oct 2020 18:23:15 +0800 [thread overview]
Message-ID: <5F9BE993.4050406@huawei.com> (raw)
In omap_lcd_interrupts(), the pointer omap_lcd is dereferenced before
being check if it is valid, which may lead to NULL pointer dereference.
So move the assignment to surface after checking that the omap_lcd is valid.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
hw/display/omap_lcdc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c
index fa4a381db6..2941c5c67c 100644
--- a/hw/display/omap_lcdc.c
+++ b/hw/display/omap_lcdc.c
@@ -78,7 +78,7 @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s)
static void omap_update_display(void *opaque)
{
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque;
- DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
+ DisplaySurface *surface;
draw_line_func draw_line;
int size, height, first, last;
int width, linesize, step, bpp, frame_offset;
@@ -89,6 +89,7 @@ static void omap_update_display(void *opaque)
return;
}
+ surface = qemu_console_surface(omap_lcd->con);
frame_offset = 0;
if (omap_lcd->plm != 2) {
cpu_physical_memory_read(
--
2.19.1
WARNING: multiple messages have this Message-ID (diff)
From: AlexChen <alex.chen@huawei.com>
To: <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, qemu-arm@nongnu.org,
QEMU <qemu-devel@nongnu.org>
Subject: [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference
Date: Fri, 30 Oct 2020 18:23:15 +0800 [thread overview]
Message-ID: <5F9BE993.4050406@huawei.com> (raw)
In omap_lcd_interrupts(), the pointer omap_lcd is dereferenced before
being check if it is valid, which may lead to NULL pointer dereference.
So move the assignment to surface after checking that the omap_lcd is valid.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
---
hw/display/omap_lcdc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c
index fa4a381db6..2941c5c67c 100644
--- a/hw/display/omap_lcdc.c
+++ b/hw/display/omap_lcdc.c
@@ -78,7 +78,7 @@ static void omap_lcd_interrupts(struct omap_lcd_panel_s *s)
static void omap_update_display(void *opaque)
{
struct omap_lcd_panel_s *omap_lcd = (struct omap_lcd_panel_s *) opaque;
- DisplaySurface *surface = qemu_console_surface(omap_lcd->con);
+ DisplaySurface *surface;
draw_line_func draw_line;
int size, height, first, last;
int width, linesize, step, bpp, frame_offset;
@@ -89,6 +89,7 @@ static void omap_update_display(void *opaque)
return;
}
+ surface = qemu_console_surface(omap_lcd->con);
frame_offset = 0;
if (omap_lcd->plm != 2) {
cpu_physical_memory_read(
--
2.19.1
next reply other threads:[~2020-10-30 10:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 10:23 AlexChen [this message]
2020-10-30 10:23 ` [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference AlexChen
2020-10-30 14:29 ` Peter Maydell
2020-10-30 14:29 ` Peter Maydell
2020-10-30 14:35 ` Peter Maydell
2020-10-30 14:35 ` Peter Maydell
2020-10-31 3:01 ` AlexChen
2020-10-31 3:01 ` AlexChen
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=5F9BE993.4050406@huawei.com \
--to=alex.chen@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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 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.