[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/26] hw/display/omap_lcdc: Fix potential NULL pointer dereferenc
From: |
Peter Maydell |
Subject: |
[PULL 19/26] hw/display/omap_lcdc: Fix potential NULL pointer dereference |
Date: |
Mon, 2 Nov 2020 17:09:58 +0000 |
From: AlexChen <alex.chen@huawei.com>
In omap_lcd_interrupts(), the pointer omap_lcd is dereferinced 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
and move surface_bits_per_pixel(surface) to after the surface assignment.
Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Message-id: 5F9CDB8A.9000001@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/display/omap_lcdc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/hw/display/omap_lcdc.c b/hw/display/omap_lcdc.c
index fa4a381db64..58e659c94ff 100644
--- a/hw/display/omap_lcdc.c
+++ b/hw/display/omap_lcdc.c
@@ -78,14 +78,18 @@ 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;
hwaddr frame_base;
- if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
- !surface_bits_per_pixel(surface)) {
+ if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable) {
+ return;
+ }
+
+ surface = qemu_console_surface(omap_lcd->con);
+ if (!surface_bits_per_pixel(surface)) {
return;
}
--
2.20.1
- [PULL 05/26] target/arm: Add read/write_neon_element32, (continued)
- [PULL 05/26] target/arm: Add read/write_neon_element32, Peter Maydell, 2020/11/02
- [PULL 07/26] target/arm: Rename neon_load_reg32 to vfp_load_reg32, Peter Maydell, 2020/11/02
- [PULL 08/26] target/arm: Add read/write_neon_element64, Peter Maydell, 2020/11/02
- [PULL 09/26] target/arm: Rename neon_load_reg64 to vfp_load_reg64, Peter Maydell, 2020/11/02
- [PULL 11/26] target/arm: Improve do_prewiden_3d, Peter Maydell, 2020/11/02
- [PULL 12/26] target/arm: Fix float16 pairwise Neon ops on big-endian hosts, Peter Maydell, 2020/11/02
- [PULL 10/26] target/arm: Simplify do_long_3d and do_2scalar_long, Peter Maydell, 2020/11/02
- [PULL 13/26] target/arm: Fix VUDOT/VSDOT (scalar) on big-endian hosts, Peter Maydell, 2020/11/02
- [PULL 17/26] hw/arm/smmuv3: Fix potential integer overflow (CID 1432363), Peter Maydell, 2020/11/02
- [PULL 16/26] disas/capstone: Fix monitor disassembly of >32 bytes, Peter Maydell, 2020/11/02
- [PULL 19/26] hw/display/omap_lcdc: Fix potential NULL pointer dereference,
Peter Maydell <=
- [PULL 15/26] target/arm: fix LORID_EL1 access check, Peter Maydell, 2020/11/02
- [PULL 18/26] hw/arm/boot: fix SVE for EL3 direct kernel boot, Peter Maydell, 2020/11/02
- [PULL 14/26] target/arm: fix handling of HCR.FB, Peter Maydell, 2020/11/02
- [PULL 20/26] hw/display/exynos4210_fimd: Fix potential NULL pointer dereference, Peter Maydell, 2020/11/02
- [PULL 21/26] target/arm: Get correct MMU index for other-security-state, Peter Maydell, 2020/11/02
- [PULL 23/26] hw/intc/arm_gicv3_cpuif: Make GIC maintenance interrupts work, Peter Maydell, 2020/11/02
- [PULL 22/26] configure: Test that gio libs from pkg-config work, Peter Maydell, 2020/11/02
- [PULL 25/26] qemu-option-trace.rst.inc: Don't use option:: markup, Peter Maydell, 2020/11/02
- [PULL 24/26] scripts/kerneldoc: For Sphinx 3 use c:macro for macros with arguments, Peter Maydell, 2020/11/02
- [PULL 26/26] tests/qtest/npcm7xx_rng-test: Disable randomness tests, Peter Maydell, 2020/11/02