mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harry Wentland <hwentlan@amd.com>
To: Colin King <colin.king@canonical.com>,
	"Wentland, Harry" <Harry.Wentland@amd.com>,
	"Li, Sun peng (Leo)" <Sunpeng.Li@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Zhou, David(ChunMing)" <David1.Zhou@amd.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][drm-next] drm/amd/display: fix a potential null pointer dereference
Date: Thu, 22 Aug 2019 19:21:12 +0000	[thread overview]
Message-ID: <5981f677-3347-1450-f787-853e97496bd4@amd.com> (raw)
In-Reply-To: <20190816221011.10750-1-colin.king@canonical.com>

On 2019-08-16 6:10 p.m., 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>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  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)
> @@ -1244,6 +1244,7 @@ static bool calc_pll_max_vco_construct(
>  	if (init_data->bp->fw_info_valid)
>  		return false;
>  
> +	fw_info = &init_data->bp->fw_info;
>  	calc_pll_cs->ctx = init_data->ctx;
>  	calc_pll_cs->ref_freq_khz = fw_info->pll_info.crystal_frequency;
>  	calc_pll_cs->min_vco_khz =
> 

  parent reply	other threads:[~2019-08-22 19:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 22:10 Colin King
2019-08-17  6:51 ` Dan Carpenter
2019-08-22 19:21 ` Harry Wentland [this message]
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=5981f677-3347-1450-f787-853e97496bd4@amd.com \
    --to=hwentlan@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=David1.Zhou@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=airlied@linux.ie \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=colin.king@canonical.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®