mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-15 22:21:57 -06:00
hw/display/exynos4210_fimd: Fix potential NULL pointer dereference
In exynos4210_fimd_update(), the pointer s is dereferinced before being check if it is valid, which may lead to NULL pointer dereference. So move the assignment to global_width after checking that the s is valid. Reported-by: Euler Robot <euler.robot@huawei.com> Signed-off-by: Alex Chen <alex.chen@huawei.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 5F9F8D88.9030102@huawei.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
0080edc45e
commit
18520fa465
1 changed files with 3 additions and 1 deletions
|
@ -1275,12 +1275,14 @@ static void exynos4210_fimd_update(void *opaque)
|
||||||
bool blend = false;
|
bool blend = false;
|
||||||
uint8_t *host_fb_addr;
|
uint8_t *host_fb_addr;
|
||||||
bool is_dirty = false;
|
bool is_dirty = false;
|
||||||
const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
|
int global_width;
|
||||||
|
|
||||||
if (!s || !s->console || !s->enabled ||
|
if (!s || !s->console || !s->enabled ||
|
||||||
surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) {
|
surface_bits_per_pixel(qemu_console_surface(s->console)) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
|
||||||
exynos4210_update_resolution(s);
|
exynos4210_update_resolution(s);
|
||||||
surface = qemu_console_surface(s->console);
|
surface = qemu_console_surface(s->console);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue