public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] nouveau: free the memory in nouveau_gart_manager_del()
@ 2011-06-25  5:53 Dan Carpenter
  2011-06-25 11:59 ` Ben Skeggs
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2011-06-25  5:53 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: kernel-janitors, Roy Spliet, open list:DRM DRIVERS

In the original code the kfree() doesn't do anything because
"mem->mm_node" has been set to NULL.  This was introduced in
d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
bo moves"

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 765f0e5..ab79bf8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -846,8 +846,8 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
 			 struct ttm_mem_reg *mem)
 {
 	nouveau_mem_node_cleanup(mem->mm_node);
-	mem->mm_node = NULL;
 	kfree(mem->mm_node);
+	mem->mm_node = NULL;
 }
 
 static int

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

* Re: [patch] nouveau: free the memory in nouveau_gart_manager_del()
  2011-06-25  5:53 [patch] nouveau: free the memory in nouveau_gart_manager_del() Dan Carpenter
@ 2011-06-25 11:59 ` Ben Skeggs
  2011-06-26 22:19 ` walter harms
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ben Skeggs @ 2011-06-25 11:59 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, Roy Spliet, open list:DRM DRIVERS

On Sat, 2011-06-25 at 08:53 +0300, Dan Carpenter wrote:
> In the original code the kfree() doesn't do anything because
> "mem->mm_node" has been set to NULL.  This was introduced in
> d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
> bo moves"
Already fixed in nouveau git, I'll get the fixes to Dave.

Ben.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
> index 765f0e5..ab79bf8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_mem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
> @@ -846,8 +846,8 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
>  			 struct ttm_mem_reg *mem)
>  {
>  	nouveau_mem_node_cleanup(mem->mm_node);
> -	mem->mm_node = NULL;
>  	kfree(mem->mm_node);
> +	mem->mm_node = NULL;
>  }
>  
>  static int



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

* Re: [patch] nouveau: free the memory in nouveau_gart_manager_del()
  2011-06-25  5:53 [patch] nouveau: free the memory in nouveau_gart_manager_del() Dan Carpenter
  2011-06-25 11:59 ` Ben Skeggs
@ 2011-06-26 22:19 ` walter harms
  2011-06-27  4:59 ` Julia Lawall
  2011-06-27  6:50 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: walter harms @ 2011-06-26 22:19 UTC (permalink / raw)
  To: kernel-janitors

great bug to make sure that mem is never freed :)

@julia,

can coccinelle find this type  ?
they will never cause an error just a memleack that never
will be notices before its to late.

re,
 wh


Am 25.06.2011 07:53, schrieb Dan Carpenter:
> In the original code the kfree() doesn't do anything because
> "mem->mm_node" has been set to NULL.  This was introduced in
> d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
> bo moves"
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
> index 765f0e5..ab79bf8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_mem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
> @@ -846,8 +846,8 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
>  			 struct ttm_mem_reg *mem)
>  {
>  	nouveau_mem_node_cleanup(mem->mm_node);
> -	mem->mm_node = NULL;
>  	kfree(mem->mm_node);
> +	mem->mm_node = NULL;
>  }
>  
>  static int
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

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

* Re: [patch] nouveau: free the memory in nouveau_gart_manager_del()
  2011-06-25  5:53 [patch] nouveau: free the memory in nouveau_gart_manager_del() Dan Carpenter
  2011-06-25 11:59 ` Ben Skeggs
  2011-06-26 22:19 ` walter harms
@ 2011-06-27  4:59 ` Julia Lawall
  2011-06-27  6:50 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2011-06-27  4:59 UTC (permalink / raw)
  To: kernel-janitors

On Mon, 27 Jun 2011, walter harms wrote:

> great bug to make sure that mem is never freed :)
> 
> @julia,
> 
> can coccinelle find this type  ?

Yes, I looked and didn't find any other than this one.

julia

> they will never cause an error just a memleack that never
> will be notices before its to late.
> 
> re,
>  wh
> 
> 
> Am 25.06.2011 07:53, schrieb Dan Carpenter:
> > In the original code the kfree() doesn't do anything because
> > "mem->mm_node" has been set to NULL.  This was introduced in
> > d2f96666c56a "drm/nouveau: create temp vmas for both src and dst of
> > bo moves"
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
> > index 765f0e5..ab79bf8 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_mem.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
> > @@ -846,8 +846,8 @@ nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
> >  			 struct ttm_mem_reg *mem)
> >  {
> >  	nouveau_mem_node_cleanup(mem->mm_node);
> > -	mem->mm_node = NULL;
> >  	kfree(mem->mm_node);
> > +	mem->mm_node = NULL;
> >  }
> >  
> >  static int
> > --
> > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [patch] nouveau: free the memory in nouveau_gart_manager_del()
  2011-06-25  5:53 [patch] nouveau: free the memory in nouveau_gart_manager_del() Dan Carpenter
                   ` (2 preceding siblings ...)
  2011-06-27  4:59 ` Julia Lawall
@ 2011-06-27  6:50 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2011-06-27  6:50 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Jun 27, 2011 at 06:59:54AM +0200, Julia Lawall wrote:
> On Mon, 27 Jun 2011, walter harms wrote:
> 
> > great bug to make sure that mem is never freed :)
> > 
> > @julia,
> > 
> > can coccinelle find this type  ?
> 
> Yes, I looked and didn't find any other than this one.
>

I've found a hand full of these in the past, but I've fixed them all.
:P

regards,
dan carpenter


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

end of thread, other threads:[~2011-06-27  6:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-25  5:53 [patch] nouveau: free the memory in nouveau_gart_manager_del() Dan Carpenter
2011-06-25 11:59 ` Ben Skeggs
2011-06-26 22:19 ` walter harms
2011-06-27  4:59 ` Julia Lawall
2011-06-27  6:50 ` Dan Carpenter

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