lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <57a7ccb9-ff94-22ad-9b66-235b42228c7f@amd.com>
Date:   Wed, 26 Apr 2023 16:59:46 -0400
From:   Hamza Mahfooz <hamza.mahfooz@....com>
To:     Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc:     dri-devel@...ts.freedesktop.org, Josip Pavic <Josip.Pavic@....com>,
        amd-gfx@...ts.freedesktop.org, error27@...il.com,
        Leo Li <sunpeng.li@....com>, kernel-janitors@...r.kernel.org,
        Qingqing Zhuo <qingqing.zhuo@....com>,
        "Pan, Xinhui" <Xinhui.Pan@....com>,
        Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
        linux-kernel@...r.kernel.org,
        Nicholas Kazlauskas <Nicholas.Kazlauskas@....com>,
        Max Tseng <Max.Tseng@....com>, Alvin Lee <Alvin.Lee2@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...il.com>, Jun Lei <Jun.Lei@....com>,
        Harry Wentland <harry.wentland@....com>,
        Christian König <christian.koenig@....com>,
        Eric Yang <Eric.Yang2@....com>
Subject: Re: [PATCH next] drm/amd/display: Fix possible NULL dereference in
 dc_dmub_srv_cmd_run_list()

On 4/26/23 15:24, Harshit Mogalapalli wrote:
> We have a NULL check for 'dc_dmub_srv' in dc_dmub_srv_cmd_run_list()
> but we are dereferencing it before checking.
> 
> Fix this moving the dereference next to NULL check.
> 
> This issue is found with Smatch(static analysis tool).
> 
> Fixes: e97cc04fe0fb ("drm/amd/display: refactor dmub commands into single function")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>

Applied, thanks!

> ---
> Only compile tested.
> ---
>   drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> index d15ec32243e2..62d3473c32bc 100644
> --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
> @@ -125,7 +125,7 @@ bool dc_dmub_srv_cmd_run(struct dc_dmub_srv *dc_dmub_srv, union dmub_rb_cmd *cmd
>   
>   bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int count, union dmub_rb_cmd *cmd_list, enum dm_dmub_wait_type wait_type)
>   {
> -	struct dc_context *dc_ctx = dc_dmub_srv->ctx;
> +	struct dc_context *dc_ctx;
>   	struct dmub_srv *dmub;
>   	enum dmub_status status;
>   	int i;
> @@ -133,6 +133,7 @@ bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int coun
>   	if (!dc_dmub_srv || !dc_dmub_srv->dmub)
>   		return false;
>   
> +	dc_ctx = dc_dmub_srv->ctx;
>   	dmub = dc_dmub_srv->dmub;
>   
>   	for (i = 0 ; i < count; i++) {
-- 
Hamza

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ