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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <32674bac-92c2-8fc7-0977-6d2d81b3257f@amd.com>
Date:   Fri, 24 Mar 2023 13:46:39 -0400
From:   Hamza Mahfooz <hamza.mahfooz@....com>
To:     Markus Elfring <Markus.Elfring@....de>,
        kernel-janitors@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org,
        Alex Deucher <alexander.deucher@....com>,
        Aurabindo Pillai <aurabindo.pillai@....com>,
        Christian König <christian.koenig@....com>,
        Daniel Vetter <daniel@...ll.ch>,
        David Airlie <airlied@...il.com>,
        Fangzhi Zuo <Jerry.Zuo@....com>,
        Harry Wentland <harry.wentland@....com>,
        Hersen Wu <hersenxs.wu@....com>, Leo Li <sunpeng.li@....com>,
        Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
        Roman Li <roman.li@....com>, Stylon Wang <stylon.wang@....com>,
        Xinhui Pan <Xinhui.Pan@....com>
Cc:     LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: Re: [PATCH resent] drm/amd/display: Fix exception handling in
 dm_validate_stream_and_context()

Hi Markus,

On 3/24/23 11:42, Markus Elfring wrote:
> Date: Sat, 18 Mar 2023 16:21:32 +0100
> 
> The label “cleanup” was used to jump to another pointer check despite of
> the detail in the implementation of the function “dm_validate_stream_and_context”
> that it was determined already that corresponding variables contained
> still null pointers.
> 
> 1. Thus return directly if
>     * a null pointer was passed for the function parameter “stream”
>       or
>     * a call of the function “dc_create_plane_state” failed.
> 
> 2. Use a more appropriate label instead.
> 
> 3. Delete two questionable checks.
> 
> 4. Omit extra initialisations (for the variables “dc_state” and “dc_plane_state”)
>     which became unnecessary with this refactoring.
> 
> 
> This issue was detected by using the Coccinelle software.
> 
> Fixes: 5468c36d628524effbb89a9503eb1a2318804759 ("drm/amd/display: Filter Invalid 420 Modes for HDMI TMDS")

Please truncate the hash to 12 characters.

> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>

Also please ensure that your Signed-off-by matches the "From:" entry in 
the email.

> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 20 ++++++++-----------
>   1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index eeaeca8b51f4..3086613f5f5d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -6426,19 +6426,19 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc,
>   						struct dc_stream_state *stream)
>   {
>   	enum dc_status dc_result = DC_ERROR_UNEXPECTED;
> -	struct dc_plane_state *dc_plane_state = NULL;
> -	struct dc_state *dc_state = NULL;
> +	struct dc_plane_state *dc_plane_state;
> +	struct dc_state *dc_state;
> 
>   	if (!stream)
> -		goto cleanup;
> +		return dc_result;
> 
>   	dc_plane_state = dc_create_plane_state(dc);
>   	if (!dc_plane_state)
> -		goto cleanup;
> +		return dc_result;
> 
>   	dc_state = dc_create_state(dc);
>   	if (!dc_state)
> -		goto cleanup;
> +		goto release_plane_state;
> 
>   	/* populate stream to plane */
>   	dc_plane_state->src_rect.height  = stream->src.height;
> @@ -6475,13 +6475,9 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc,
>   	if (dc_result == DC_OK)
>   		dc_result = dc_validate_global_state(dc, dc_state, true);
> 
> -cleanup:
> -	if (dc_state)
> -		dc_release_state(dc_state);
> -
> -	if (dc_plane_state)
> -		dc_plane_state_release(dc_plane_state);
> -
> +	dc_release_state(dc_state);
> +release_plane_state:
> +	dc_plane_state_release(dc_plane_state);
>   	return dc_result;
>   }
> 
> --
> 2.40.0
> 

-- 
Hamza

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ