From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Colin King <colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: "David Zhou" <David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
"Leo Li" <sunpeng.li-5C7GfCeVMHo@public.gmane.org>,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
"Daniel Vetter" <daniel-/w4YWyX8dFk@public.gmane.org>,
"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
"Harry Wentland" <harry.wentland-5C7GfCeVMHo@public.gmane.org>,
"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH][drm-next] drm/amd/display: fix a potential null pointer dereference
Date: Sat, 17 Aug 2019 09:51:46 +0300 [thread overview]
Message-ID: <20190817065146.GA4451@kadam> (raw)
In-Reply-To: <20190816221011.10750-1-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
On Fri, Aug 16, 2019 at 11:10:11PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently the pointer init_data is dereferenced on the assignment
> of fw_info before init_data is sanity checked to see if it is null.
> Fix te potential null pointer dereference on init_data by only
> performing dereference after it is null checked.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: 9adc8050bf3c ("drm/amd/display: make firmware info only load once during dc_bios create")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> index bee81bf288be..926954c804a6 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
> @@ -1235,7 +1235,7 @@ static bool calc_pll_max_vco_construct(
> struct calc_pll_clock_source_init_data *init_data)
> {
> uint32_t i;
> - struct dc_firmware_info *fw_info = &init_data->bp->fw_info;
> + struct dc_firmware_info *fw_info;
> if (calc_pll_cs == NULL ||
> init_data == NULL ||
> init_data->bp == NULL)
init_data can't be NULL. I'm mostly pointing this out because that NULL
check is written so higgledy-piggledy. At first I thought this was
staging code so I was planning to ignore the patch. :P
regards,
dan carpenter
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-08-17 6:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 22:10 [PATCH][drm-next] drm/amd/display: fix a potential null pointer dereference Colin King
[not found] ` <20190816221011.10750-1-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2019-08-17 6:51 ` Dan Carpenter [this message]
2019-08-22 19:21 ` Harry Wentland
2019-08-22 20:55 ` Alex Deucher
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=20190817065146.GA4451@kadam \
--to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=harry.wentland-5C7GfCeVMHo@public.gmane.org \
--cc=kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sunpeng.li-5C7GfCeVMHo@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox