Skip to content

Commit 707db37

Browse files
committed
drm/msm/dpu: check for the plane pitch overflow
Check that the plane pitch doesn't overflow the maximum pitch size allowed by the hardware. Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Tested-by: Abhinav Kumar <quic_abhinavk@quicinc.com> # sc7280 Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/612253/ Link: https://lore.kernel.org/r/20240903-dpu-mode-config-width-v6-13-617e1ecc4b7a@linaro.org
1 parent dc0def6 commit 707db37

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
struct dpu_hw_sspp;
1414

15+
#define DPU_SSPP_MAX_PITCH_SIZE 0xffff
16+
1517
/**
1618
* Flags
1719
*/

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
782782
{
783783
struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
784784
plane);
785-
int ret = 0, min_scale;
785+
int i, ret = 0, min_scale;
786786
struct dpu_plane *pdpu = to_dpu_plane(plane);
787787
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
788788
u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate;
@@ -856,6 +856,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
856856
return ret;
857857
}
858858

859+
for (i = 0; i < pstate->layout.num_planes; i++)
860+
if (pstate->layout.plane_pitch[i] > DPU_SSPP_MAX_PITCH_SIZE)
861+
return -E2BIG;
862+
859863
fmt = msm_framebuffer_format(new_plane_state->fb);
860864

861865
max_linewidth = pdpu->catalog->caps->max_linewidth;

0 commit comments

Comments
 (0)