linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: fix application of sizeof to pointer
@ 2021-11-24  3:04 cgel.zte
  2021-11-25 16:32 ` Rodrigo Siqueira Jordao
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-24  3:04 UTC (permalink / raw)
  To: sunpeng.li
  Cc: harry.wentland, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, jun.lei,
	wayne.lin, lv.ruyi, amd-gfx, dri-devel, linux-kernel, Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

Both of split and merge are pointers, not arrays.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
index ece34b0b8a46..91810aaee5a3 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
@@ -1223,8 +1223,8 @@ static void dml_full_validate_bw_helper(struct dc *dc,
 		*pipe_cnt = dml_populate_dml_pipes_from_context(dc, context, pipes, false);
 		*vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, *pipe_cnt);
 		if (*vlevel < context->bw_ctx.dml.soc.num_states) {
-			memset(split, 0, sizeof(split));
-			memset(merge, 0, sizeof(merge));
+			memset(split, 0, MAX_PIPES * sizeof(*split));
+			memset(merge, 0, MAX_PIPES * sizeof(*merge));
 			*vlevel = dml_validate_apply_pipe_split_flags(dc, context, *vlevel, split, merge);
 		}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: fix application of sizeof to pointer
  2021-11-24  3:04 [PATCH] drm/amd/display: fix application of sizeof to pointer cgel.zte
@ 2021-11-25 16:32 ` Rodrigo Siqueira Jordao
  0 siblings, 0 replies; 2+ messages in thread
From: Rodrigo Siqueira Jordao @ 2021-11-25 16:32 UTC (permalink / raw)
  To: cgel.zte, sunpeng.li
  Cc: harry.wentland, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, jun.lei,
	wayne.lin, lv.ruyi, amd-gfx, dri-devel, linux-kernel, Zeal Robot



On 2021-11-23 10:04 p.m., cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
> 
> Both of split and merge are pointers, not arrays.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
> ---
>   drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
> index ece34b0b8a46..91810aaee5a3 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c
> @@ -1223,8 +1223,8 @@ static void dml_full_validate_bw_helper(struct dc *dc,
>   		*pipe_cnt = dml_populate_dml_pipes_from_context(dc, context, pipes, false);
>   		*vlevel = dml_get_voltage_level(&context->bw_ctx.dml, pipes, *pipe_cnt);
>   		if (*vlevel < context->bw_ctx.dml.soc.num_states) {
> -			memset(split, 0, sizeof(split));
> -			memset(merge, 0, sizeof(merge));
> +			memset(split, 0, MAX_PIPES * sizeof(*split));
> +			memset(merge, 0, MAX_PIPES * sizeof(*merge));
>   			*vlevel = dml_validate_apply_pipe_split_flags(dc, context, *vlevel, split, merge);
>   		}
>   
> 
Nice catch!

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>

and applied to amd-staging-drm-next

Thanks
Siqueira

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-25 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  3:04 [PATCH] drm/amd/display: fix application of sizeof to pointer cgel.zte
2021-11-25 16:32 ` Rodrigo Siqueira Jordao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).