mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference
@ 2014-04-15  1:56 Daeseok Youn
  2014-04-15  7:00 ` Ben Skeggs
  0 siblings, 1 reply; 3+ messages in thread
From: Daeseok Youn @ 2014-04-15  1:56 UTC (permalink / raw)
  To: airlied; +Cc: bskeggs, dri-devel, linux-kernel


It need to be checking NULL before dereferencing.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/gpu/drm/nouveau/core/subdev/clock/base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
index dd62bae..a586d030 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
@@ -290,9 +290,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx)
 		return 0;
 
 	pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
-	cstate = &pstate->base;
 	if (!pstate)
 		return -ENOMEM;
+	cstate = &pstate->base;
 
 	INIT_LIST_HEAD(&pstate->list);
 
-- 
1.7.4.4



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

* Re: [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference
  2014-04-15  1:56 [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference Daeseok Youn
@ 2014-04-15  7:00 ` Ben Skeggs
  2014-04-15  9:15   ` DaeSeok Youn
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Skeggs @ 2014-04-15  7:00 UTC (permalink / raw)
  To: Daeseok Youn; +Cc: airlied, dri-devel, linux-kernel

----- Original Message -----
> From: "Daeseok Youn" <daeseok.youn@gmail.com>
> To: airlied@linux.ie
> Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
> Sent: Tuesday, 15 April, 2014 11:56:49 AM
> Subject: [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference
> 
> 
> It need to be checking NULL before dereferencing.
There's no dereference here.  It's an address calculation only.

> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/core/subdev/clock/base.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> index dd62bae..a586d030 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> @@ -290,9 +290,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx)
>  		return 0;
>  
>  	pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
> -	cstate = &pstate->base;
>  	if (!pstate)
>  		return -ENOMEM;
> +	cstate = &pstate->base;
>  
>  	INIT_LIST_HEAD(&pstate->list);
>  
> --
> 1.7.4.4
> 
> 
> 

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

* Re: [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference
  2014-04-15  7:00 ` Ben Skeggs
@ 2014-04-15  9:15   ` DaeSeok Youn
  0 siblings, 0 replies; 3+ messages in thread
From: DaeSeok Youn @ 2014-04-15  9:15 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: airlied, dri-devel, linux-kernel

2014-04-15 16:00 GMT+09:00 Ben Skeggs <bskeggs@redhat.com>:
> ----- Original Message -----
>> From: "Daeseok Youn" <daeseok.youn@gmail.com>
>> To: airlied@linux.ie
>> Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
>> Sent: Tuesday, 15 April, 2014 11:56:49 AM
>> Subject: [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference
>>
>>
>> It need to be checking NULL before dereferencing.
> There's no dereference here.  It's an address calculation only.
Oh.. You're right.
But the address calculation doesn't need when "pstate" is NULL.
Can I re-send this patch after modifying subject and comment of this
patch properly?
Or drop this patch.

Thanks for review.

Regards,
Daeseok Youn.
>
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>> ---
>>  drivers/gpu/drm/nouveau/core/subdev/clock/base.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> index dd62bae..a586d030 100644
>> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> @@ -290,9 +290,9 @@ nouveau_pstate_new(struct nouveau_clock *clk, int idx)
>>               return 0;
>>
>>       pstate = kzalloc(sizeof(*pstate), GFP_KERNEL);
>> -     cstate = &pstate->base;
>>       if (!pstate)
>>               return -ENOMEM;
>> +     cstate = &pstate->base;
>>
>>       INIT_LIST_HEAD(&pstate->list);
>>
>> --
>> 1.7.4.4
>>
>>
>>

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

end of thread, other threads:[~2014-04-15  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15  1:56 [PATCH] drm/nouveau/clk: fix possible NULL pointer dereference Daeseok Youn
2014-04-15  7:00 ` Ben Skeggs
2014-04-15  9:15   ` DaeSeok Youn

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

Powered by JetHome