Skip to contentSkip to conversation

drm/amd/display: fix application of sizeof to pointer

PATCH In review [email protected] 2 participants 2 messages Nov 24, 2021 – Nov 25, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: fix application of sizeof to pointer

From: Lv Ruyi <[email protected]>

Both of split and merge are pointers, not arrays.

---
 drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c +2 -2
index ece34b0b8a46..91810aaee5a3 100644
@@ -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);
 		}
 
Signature · 1 line
2.25.1
Reviewed-by Rodrigo Siqueira on v1 1/1
#1 lore raw
Quoted 16 lines · On 2021-11-23 10:04 p.m., [email protected] wrote:

From: Lv Ruyi <[email protected]>

Both of split and merge are pointers, not arrays.

---
  drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c +0 -0
index ece34b0b8a46..91810aaee5a3 100644

drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c static void dml_full_validate_bw_helper(struct dc *dc, · line 1230

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dml/dml_wrapper.c +2 -2
@@ -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!

and applied to amd-staging-drm-next

Thanks
Siqueira