public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/a6xx: fix a potential overflow issue
@ 2020-09-12 10:25 Zhenzhong Duan
  2020-09-14 16:20 ` Jordan Crouse
  2020-09-15  0:34 ` Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Zhenzhong Duan @ 2020-09-12 10:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: robdclark, sean, airlied, daniel, smasetty, jcrouse, jonathan,
	linux-arm-msm, dri-devel, freedreno, Zhenzhong Duan

It's allocating an array of a6xx_gpu_state_obj structure rathor than
its pointers.

This patch fix it.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index b12f5b4..e9ede19 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
 	int i;
 
 	a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
-		sizeof(a6xx_state->indexed_regs));
+		sizeof(*a6xx_state->indexed_regs));
 	if (!a6xx_state->indexed_regs)
 		return;
 
-- 
1.8.3.1


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

* Re: [PATCH] drm/msm/a6xx: fix a potential overflow issue
  2020-09-12 10:25 [PATCH] drm/msm/a6xx: fix a potential overflow issue Zhenzhong Duan
@ 2020-09-14 16:20 ` Jordan Crouse
  2020-09-16  2:28   ` Zhenzhong Duan
  2020-09-15  0:34 ` Bjorn Andersson
  1 sibling, 1 reply; 4+ messages in thread
From: Jordan Crouse @ 2020-09-14 16:20 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: linux-kernel, robdclark, sean, airlied, daniel, smasetty,
	jonathan, linux-arm-msm, dri-devel, freedreno

On Sat, Sep 12, 2020 at 06:25:58PM +0800, Zhenzhong Duan wrote:
> It's allocating an array of a6xx_gpu_state_obj structure rathor than
> its pointers.
> 
> This patch fix it.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>

LGTM but should have a Fixes: tag for the stable trees

Fixes: d6852b4b2d01 ("drm/msm/a6xx: Track and manage a6xx state memory")
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>

> ---
>  drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> index b12f5b4..e9ede19 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> @@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
>  	int i;
>  
>  	a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
> -		sizeof(a6xx_state->indexed_regs));
> +		sizeof(*a6xx_state->indexed_regs));
>  	if (!a6xx_state->indexed_regs)
>  		return;
>  
> -- 
> 1.8.3.1
> 

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH] drm/msm/a6xx: fix a potential overflow issue
  2020-09-12 10:25 [PATCH] drm/msm/a6xx: fix a potential overflow issue Zhenzhong Duan
  2020-09-14 16:20 ` Jordan Crouse
@ 2020-09-15  0:34 ` Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2020-09-15  0:34 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: linux-kernel, robdclark, sean, airlied, daniel, smasetty, jcrouse,
	jonathan, linux-arm-msm, dri-devel, freedreno

On Sat 12 Sep 10:25 UTC 2020, Zhenzhong Duan wrote:

> It's allocating an array of a6xx_gpu_state_obj structure rathor than
> its pointers.
> 
> This patch fix it.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
> ---
>  drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> index b12f5b4..e9ede19 100644
> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
> @@ -875,7 +875,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,
>  	int i;
>  
>  	a6xx_state->indexed_regs = state_kcalloc(a6xx_state, count,
> -		sizeof(a6xx_state->indexed_regs));
> +		sizeof(*a6xx_state->indexed_regs));
>  	if (!a6xx_state->indexed_regs)
>  		return;
>  
> -- 
> 1.8.3.1
> 

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

* Re: [PATCH] drm/msm/a6xx: fix a potential overflow issue
  2020-09-14 16:20 ` Jordan Crouse
@ 2020-09-16  2:28   ` Zhenzhong Duan
  0 siblings, 0 replies; 4+ messages in thread
From: Zhenzhong Duan @ 2020-09-16  2:28 UTC (permalink / raw)
  To: Zhenzhong Duan, linux-kernel, robdclark, sean, airlied,
	Daniel Vetter, smasetty, Jonathan Marek, linux-arm-msm, dri-devel,
	freedreno

On Tue, Sep 15, 2020 at 12:20 AM Jordan Crouse <jcrouse@codeaurora.org> wrote:
>
> On Sat, Sep 12, 2020 at 06:25:58PM +0800, Zhenzhong Duan wrote:
> > It's allocating an array of a6xx_gpu_state_obj structure rathor than
> > its pointers.
> >
> > This patch fix it.
> >
> > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@gmail.com>
>
> LGTM but should have a Fixes: tag for the stable trees
>
> Fixes: d6852b4b2d01 ("drm/msm/a6xx: Track and manage a6xx state memory")
> Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>

I had sent a v2 version with same change as you suggested on Sep 14,
could you help review it? Thanks
https://lkml.org/lkml/2020/9/13/311

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

end of thread, other threads:[~2020-09-16  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-12 10:25 [PATCH] drm/msm/a6xx: fix a potential overflow issue Zhenzhong Duan
2020-09-14 16:20 ` Jordan Crouse
2020-09-16  2:28   ` Zhenzhong Duan
2020-09-15  0:34 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox