From: AlexChen <alex.chen@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU <qemu-devel@nongnu.org>,
QEMU Trivial <qemu-trivial@nongnu.org>
Subject: Re: [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference
Date: Sat, 31 Oct 2020 11:01:21 +0800 [thread overview]
Message-ID: <5F9CD381.9010507@huawei.com> (raw)
In-Reply-To: <CAFEAcA-WTw-0EvT1REbTrtgLB9sBbnJBuNW9LMh7eOtsXtrDTw@mail.gmail.com>
On 2020/10/30 22:35, Peter Maydell wrote:
> On Fri, 30 Oct 2020 at 14:29, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Fri, 30 Oct 2020 at 10:23, AlexChen <alex.chen@huawei.com> wrote:
>>>
>>> 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(-)
>
>> Applied to target-arm.next, thanks.
>
> Whoops, spoke too soon. This doesn't compile:
>
> ../../hw/display/omap_lcdc.c: In function ‘omap_update_display’:
> ../../hw/display/omap_lcdc.c:88:10: error: ‘surface’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> !surface_bits_per_pixel(surface)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> because the early exit check
> if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
> !surface_bits_per_pixel(surface)) {
> return;
> }
>
> uses 'surface' and this patch moves the initialization of that
> variable down below its first use.
>
Oh, I apologize for this compilation error, I will fix it in my patch v2.
Thanks,
Alex
WARNING: multiple messages have this Message-ID (diff)
From: AlexChen <alex.chen@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
qemu-arm <qemu-arm@nongnu.org>, QEMU <qemu-devel@nongnu.org>
Subject: Re: [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference
Date: Sat, 31 Oct 2020 11:01:21 +0800 [thread overview]
Message-ID: <5F9CD381.9010507@huawei.com> (raw)
In-Reply-To: <CAFEAcA-WTw-0EvT1REbTrtgLB9sBbnJBuNW9LMh7eOtsXtrDTw@mail.gmail.com>
On 2020/10/30 22:35, Peter Maydell wrote:
> On Fri, 30 Oct 2020 at 14:29, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Fri, 30 Oct 2020 at 10:23, AlexChen <alex.chen@huawei.com> wrote:
>>>
>>> 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(-)
>
>> Applied to target-arm.next, thanks.
>
> Whoops, spoke too soon. This doesn't compile:
>
> ../../hw/display/omap_lcdc.c: In function ‘omap_update_display’:
> ../../hw/display/omap_lcdc.c:88:10: error: ‘surface’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> !surface_bits_per_pixel(surface)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> because the early exit check
> if (!omap_lcd || omap_lcd->plm == 1 || !omap_lcd->enable ||
> !surface_bits_per_pixel(surface)) {
> return;
> }
>
> uses 'surface' and this patch moves the initialization of that
> variable down below its first use.
>
Oh, I apologize for this compilation error, I will fix it in my patch v2.
Thanks,
Alex
next prev parent reply other threads:[~2020-10-31 3:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 10:23 [PATCH] hw/display/omap_lcdc: Fix potential NULL pointer dereference AlexChen
2020-10-30 10:23 ` 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 [this message]
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=5F9CD381.9010507@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.