All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/dpu: Add check for pstates
@ 2022-12-06  8:02 ` Jiasheng Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2022-12-06  8:02 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, dmitry.baryshkov, sean, airlied,
	daniel, quic_jesszhan, ville.syrjala, yang.lee
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jiasheng Jiang

As kzalloc may fail and return NULL pointer,
it should be better to check pstates
in order to avoid the NULL pointer dereference.

Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 13ce321283ff..f51cb46ecfd6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1150,6 +1150,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
 
 	pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
+	if (!pstates)
+		return -ENOMEM;
 
 	if (!crtc_state->enable || !crtc_state->active) {
 		DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",
-- 
2.25.1


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

* [PATCH] drm/msm/dpu: Add check for pstates
@ 2022-12-06  8:02 ` Jiasheng Jiang
  0 siblings, 0 replies; 6+ messages in thread
From: Jiasheng Jiang @ 2022-12-06  8:02 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, dmitry.baryshkov, sean, airlied,
	daniel, quic_jesszhan, ville.syrjala, yang.lee
  Cc: linux-arm-msm, Jiasheng Jiang, freedreno, linux-kernel, dri-devel

As kzalloc may fail and return NULL pointer,
it should be better to check pstates
in order to avoid the NULL pointer dereference.

Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 13ce321283ff..f51cb46ecfd6 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1150,6 +1150,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
 	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
 
 	pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
+	if (!pstates)
+		return -ENOMEM;
 
 	if (!crtc_state->enable || !crtc_state->active) {
 		DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",
-- 
2.25.1


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

* Re: [PATCH] drm/msm/dpu: Add check for pstates
  2022-12-06  8:02 ` Jiasheng Jiang
@ 2022-12-13 21:37   ` Abhinav Kumar
  -1 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2022-12-13 21:37 UTC (permalink / raw)
  To: Jiasheng Jiang, robdclark, dmitry.baryshkov, sean, airlied,
	daniel, quic_jesszhan, ville.syrjala, yang.lee
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel



On 12/6/2022 12:02 AM, Jiasheng Jiang wrote:
> As kzalloc may fail and return NULL pointer,
> it should be better to check pstates
> in order to avoid the NULL pointer dereference.
> 
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Once again, your lines are wrapped around too early, please use the full 
character limit for the commit text.

With that fixed,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 13ce321283ff..f51cb46ecfd6 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1150,6 +1150,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>   	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
>   
>   	pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
> +	if (!pstates)
> +		return -ENOMEM;
>   
>   	if (!crtc_state->enable || !crtc_state->active) {
>   		DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",

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

* Re: [PATCH] drm/msm/dpu: Add check for pstates
@ 2022-12-13 21:37   ` Abhinav Kumar
  0 siblings, 0 replies; 6+ messages in thread
From: Abhinav Kumar @ 2022-12-13 21:37 UTC (permalink / raw)
  To: Jiasheng Jiang, robdclark, dmitry.baryshkov, sean, airlied,
	daniel, quic_jesszhan, ville.syrjala, yang.lee
  Cc: linux-arm-msm, freedreno, linux-kernel, dri-devel



On 12/6/2022 12:02 AM, Jiasheng Jiang wrote:
> As kzalloc may fail and return NULL pointer,
> it should be better to check pstates
> in order to avoid the NULL pointer dereference.
> 
> Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Once again, your lines are wrapped around too early, please use the full 
character limit for the commit text.

With that fixed,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>

> ---
>   drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 13ce321283ff..f51cb46ecfd6 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -1150,6 +1150,8 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>   	bool needs_dirtyfb = dpu_crtc_needs_dirtyfb(crtc_state);
>   
>   	pstates = kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL);
> +	if (!pstates)
> +		return -ENOMEM;
>   
>   	if (!crtc_state->enable || !crtc_state->active) {
>   		DRM_DEBUG_ATOMIC("crtc%d -> enable %d, active %d, skip atomic_check\n",

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

* Re: [PATCH] drm/msm/dpu: Add check for pstates
  2022-12-06  8:02 ` Jiasheng Jiang
@ 2023-01-26 19:01   ` Dmitry Baryshkov
  -1 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-01-26 19:01 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, sean, airlied, daniel, quic_jesszhan,
	ville.syrjala, yang.lee, Jiasheng Jiang
  Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel


On Tue, 06 Dec 2022 16:02:36 +0800, Jiasheng Jiang wrote:
> As kzalloc may fail and return NULL pointer,
> it should be better to check pstates
> in order to avoid the NULL pointer dereference.
> 
> 

Applied, thanks!

[1/1] drm/msm/dpu: Add check for pstates
      https://gitlab.freedesktop.org/lumag/msm/-/commit/93340e10b9c5

Best regards,
-- 
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

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

* Re: [PATCH] drm/msm/dpu: Add check for pstates
@ 2023-01-26 19:01   ` Dmitry Baryshkov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2023-01-26 19:01 UTC (permalink / raw)
  To: robdclark, quic_abhinavk, sean, airlied, daniel, quic_jesszhan,
	ville.syrjala, yang.lee, Jiasheng Jiang
  Cc: linux-arm-msm, freedreno, linux-kernel, dri-devel


On Tue, 06 Dec 2022 16:02:36 +0800, Jiasheng Jiang wrote:
> As kzalloc may fail and return NULL pointer,
> it should be better to check pstates
> in order to avoid the NULL pointer dereference.
> 
> 

Applied, thanks!

[1/1] drm/msm/dpu: Add check for pstates
      https://gitlab.freedesktop.org/lumag/msm/-/commit/93340e10b9c5

Best regards,
-- 
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

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

end of thread, other threads:[~2023-01-26 19:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06  8:02 [PATCH] drm/msm/dpu: Add check for pstates Jiasheng Jiang
2022-12-06  8:02 ` Jiasheng Jiang
2022-12-13 21:37 ` Abhinav Kumar
2022-12-13 21:37   ` Abhinav Kumar
2023-01-26 19:01 ` Dmitry Baryshkov
2023-01-26 19:01   ` Dmitry Baryshkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.