[ofa-general] [PATCH 1/1 v2] SDP - Fix a memory leak in bzcopy

Jim Mott jim at mellanox.com
Tue Nov 20 14:55:54 PST 2007


A better fix of a potential memory leak in the new bzcopy code.

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>
---

Index: ofa_1_3_dev_kernel/drivers/infiniband/ulp/sdp/sdp_main.c
===================================================================
--- ofa_1_3_dev_kernel.orig/drivers/infiniband/ulp/sdp/sdp_main.c
2007-11-19 16:40:26.000000000 -0600
+++ ofa_1_3_dev_kernel/drivers/infiniband/ulp/sdp/sdp_main.c
2007-11-19 16:40:51.000000000 -0600
@@ -1238,10 +1238,6 @@
 	if (!can_do_mlock())
 		return NULL;
 
-	bz = kzalloc(sizeof(*bz), GFP_KERNEL);
-	if (!bz)
-		return NULL;
-
 	/*
 	 *   Since we use the TCP segmentation fields of the skb to map
user
 	 * pages, we must make sure that everything we send in a single
chunk
@@ -1251,6 +1247,10 @@
 	if (size_goal >= MAX_SKB_FRAGS)
 		return NULL;
 
+	bz = kzalloc(sizeof(*bz), GFP_KERNEL);
+	if (!bz)
+		return NULL;
+
 	addr = (unsigned long)base;
 
 	bz->u_base     = base;



More information about the general mailing list