From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Su Hui <suhui@nfschina.com>,
airlied@redhat.com, tzimmermann@suse.de, airlied@gmail.com,
daniel@ffwll.ch
Cc: eich@suse.de, tiwai@suse.de, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/ast: Avoid possible NULL dereference
Date: Mon, 21 Aug 2023 09:04:36 +0200 [thread overview]
Message-ID: <38503377-ec27-09dd-dc6b-836a9ac0a5df@wanadoo.fr> (raw)
In-Reply-To: <20230821062159.198691-1-suhui@nfschina.com>
Le 21/08/2023 à 08:22, Su Hui a écrit :
> smatch error:
> drivers/gpu/drm/ast/ast_dp501.c:227 ast_launch_m68k() error:
> we previously assumed 'ast->dp501_fw' could be null (see line 223)
>
> when "!ast->dp501_fw" and "ast_load_dp501_microcode(dev) >= 0" is true,
> there will be a NULL dereference of 'ast->dp501_fw'.
>
> Fixes: 12f8030e05c6 ("drm/ast: Actually load DP501 firmware when required")
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---
> drivers/gpu/drm/ast/ast_dp501.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c
> index 1bc35a992369..d9f3a0786a6f 100644
> --- a/drivers/gpu/drm/ast/ast_dp501.c
> +++ b/drivers/gpu/drm/ast/ast_dp501.c
> @@ -224,8 +224,10 @@ static bool ast_launch_m68k(struct drm_device *dev)
> ast_load_dp501_microcode(dev) < 0)
> return false;
>
> - fw_addr = (u8 *)ast->dp501_fw->data;
> - len = ast->dp501_fw->size;
> + if (ast->dp501_fw) {
> + fw_addr = (u8 *)ast->dp501_fw->data;
> + len = ast->dp501_fw->size;
> + }
> }
> /* Get BootAddress */
> ast_moutdwm(ast, 0x1e6e2000, 0x1688a8a8);
Hi,
this looks like a false positive.
If "!ast->dp501_fw", and ast_load_dp501_microcode()>=0, then
ast_load_dp501_microcode() will set a valid value in ast->dp501_fw.
CJ
next prev parent reply other threads:[~2023-08-21 7:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-21 6:22 Su Hui
2023-08-21 7:04 ` Christophe JAILLET [this message]
2023-08-21 7:16 ` Su Hui
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=38503377-ec27-09dd-dc6b-836a9ac0a5df@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=eich@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suhui@nfschina.com \
--cc=tiwai@suse.de \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®