Skip to contentSkip to conversation

nouveau: free the memory in nouveau_gart_manager_del()

PATCH In review Dan Carpenter 4 participants 5 messages Jun 25, 2011 – Jun 27, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: free the memory in nouveau_gart_manager_del()

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"

drivers/gpu/drm/nouveau/nouveau_mem.c +1 -1
index 765f0e5..ab79bf8 100644
@@ -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
#1 lore raw
Quoted 4 lines · 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"

Already fixed in nouveau git, I'll get the fixes to Dave.

Ben.

Quoted 17 lines
drivers/gpu/drm/nouveau/nouveau_mem.c +1 -1
index 765f0e5..ab79bf8 100644
@@ -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
#2 lore raw
In reply to Dan Carpenter

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:

Quoted 27 lines

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"

drivers/gpu/drm/nouveau/nouveau_mem.c +1 -2
index 765f0e5..ab79bf8 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Dan Carpenter
Quoted 5 lines · walter harms

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

Quoted 40 lines

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:

Quoted 22 lines

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"

drivers/gpu/drm/nouveau/nouveau_mem.c +1 -2
index 765f0e5..ab79bf8 100644
@@ -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
--
Quoted 5 lines

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Julia Lawall
Quoted 5 lines · walter harms

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