linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dc.c:use kzalloc without test
@ 2019-10-23  8:32 zhongshiqi
  2019-10-23 13:35 ` Harry Wentland
  0 siblings, 1 reply; 3+ messages in thread
From: zhongshiqi @ 2019-10-23  8:32 UTC (permalink / raw)
  To: harry.wentland
  Cc: sunpeng.li, alexander.deucher, christian.koenig, David1.Zhou,
	airlied, daniel, Bhawanpreet.Lakha, Jun.Lei, David.Francis,
	Dmytro.Laktyushkin, anthony.koo, Wenjing.Liu,
	nicholas.kazlauskas, Aidan.Wood, Chris.Park, Eric.Yang2, amd-gfx,
	dri-devel, linux-kernel, xue.zhihong, wang.yi59, cheng.shengyu,
	zhongshiqi

dc.c:583:null check is needed after using kzalloc function

Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 5d1aded..4b8819c 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -580,6 +580,10 @@ static bool construct(struct dc *dc,
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
 	// Allocate memory for the vm_helper
 	dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
+	if (!dc->vm_helper) {
+		dm_error("%s: failed to create dc->vm_helper\n", __func__);
+		goto fail;
+	}
 
 #endif
 	memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));
-- 
2.9.5


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

* Re: [PATCH] dc.c:use kzalloc without test
  2019-10-23  8:32 [PATCH] dc.c:use kzalloc without test zhongshiqi
@ 2019-10-23 13:35 ` Harry Wentland
  2019-10-25 19:32   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Wentland @ 2019-10-23 13:35 UTC (permalink / raw)
  To: zhongshiqi, Wentland, Harry
  Cc: Li, Sun peng (Leo),
	Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
	airlied, daniel, Lakha, Bhawanpreet, Lei, Jun, David.Francis,
	Laktyushkin, Dmytro, Koo, Anthony, Liu, Wenjing, Kazlauskas,
	Nicholas, Aidan.Wood, Park, Chris, Yang, Eric, amd-gfx,
	dri-devel, linux-kernel, xue.zhihong, wang.yi59, cheng.shengyu

On 2019-10-23 4:32 a.m., zhongshiqi wrote:
> dc.c:583:null check is needed after using kzalloc function
> 
> Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> index 5d1aded..4b8819c 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> @@ -580,6 +580,10 @@ static bool construct(struct dc *dc,
>  #ifdef CONFIG_DRM_AMD_DC_DCN2_0
>  	// Allocate memory for the vm_helper
>  	dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
> +	if (!dc->vm_helper) {
> +		dm_error("%s: failed to create dc->vm_helper\n", __func__);
> +		goto fail;
> +	}
>  
>  #endif
>  	memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));
> 

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

* Re: [PATCH] dc.c:use kzalloc without test
  2019-10-23 13:35 ` Harry Wentland
@ 2019-10-25 19:32   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2019-10-25 19:32 UTC (permalink / raw)
  To: Harry Wentland
  Cc: zhongshiqi, Wentland, Harry, airlied, dri-devel, Lei, Jun, Koo,
	Anthony, Zhou, David(ChunMing),
	David.Francis, Liu, Wenjing, amd-gfx, cheng.shengyu, wang.yi59,
	Li, Sun peng (Leo),
	Aidan.Wood, xue.zhihong, Lakha, Bhawanpreet, Park, Chris, Yang,
	Eric, linux-kernel, Koenig, Christian, Laktyushkin, Dmytro,
	daniel, Deucher, Alexander, Kazlauskas, Nicholas

Applied.  thanks!

Alex

On Wed, Oct 23, 2019 at 9:35 AM Harry Wentland <hwentlan@amd.com> wrote:
>
> On 2019-10-23 4:32 a.m., zhongshiqi wrote:
> > dc.c:583:null check is needed after using kzalloc function
> >
> > Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
>
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>
>
> Harry
>
> > ---
> >  drivers/gpu/drm/amd/display/dc/core/dc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > index 5d1aded..4b8819c 100644
> > --- a/drivers/gpu/drm/amd/display/dc/core/dc.c
> > +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
> > @@ -580,6 +580,10 @@ static bool construct(struct dc *dc,
> >  #ifdef CONFIG_DRM_AMD_DC_DCN2_0
> >       // Allocate memory for the vm_helper
> >       dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
> > +     if (!dc->vm_helper) {
> > +             dm_error("%s: failed to create dc->vm_helper\n", __func__);
> > +             goto fail;
> > +     }
> >
> >  #endif
> >       memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2019-10-25 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  8:32 [PATCH] dc.c:use kzalloc without test zhongshiqi
2019-10-23 13:35 ` Harry Wentland
2019-10-25 19:32   ` Alex Deucher

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).