if (!ctrs)
                return -ENOMEM;
 
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr) {
                kfree(ctrs);
                return -ENOMEM;
                rc = cfs_trace_copyout_string(buffer, nob,
                                              tmpstr + pos, "\n");
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kfree(tmpstr);
        kfree(ctrs);
        return rc;
 }
        if (!*lenp)
                return 0;
 
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr)
                return -ENOMEM;
 
 
                if (ver != LNET_PROC_VERSION(the_lnet.ln_remote_nets_version)) {
                        lnet_net_unlock(0);
-                       LIBCFS_FREE(tmpstr, tmpsiz);
+                       kfree(tmpstr);
                        return -ESTALE;
                }
 
                }
        }
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kfree(tmpstr);
 
        if (!rc)
                *lenp = len;
        if (!*lenp)
                return 0;
 
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr)
                return -ENOMEM;
 
                if (ver != LNET_PROC_VERSION(the_lnet.ln_routers_version)) {
                        lnet_net_unlock(0);
 
-                       LIBCFS_FREE(tmpstr, tmpsiz);
+                       kfree(tmpstr);
                        return -ESTALE;
                }
 
                }
        }
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kfree(tmpstr);
 
        if (!rc)
                *lenp = len;
                return 0;
        }
 
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr)
                return -ENOMEM;
 
 
                if (ver != LNET_PROC_VERSION(ptable->pt_version)) {
                        lnet_net_unlock(cpt);
-                       LIBCFS_FREE(tmpstr, tmpsiz);
+                       kfree(tmpstr);
                        return -ESTALE;
                }
 
                        *ppos = LNET_PROC_POS_MAKE(cpt, ver, hash, hoff);
        }
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kfree(tmpstr);
 
        if (!rc)
                *lenp = len;
 
        /* (4 %d) * 4 * LNET_CPT_NUMBER */
        tmpsiz = 64 * (LNET_NRBPOOLS + 1) * LNET_CPT_NUMBER;
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kvmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr)
                return -ENOMEM;
 
                rc = cfs_trace_copyout_string(buffer, nob,
                                              tmpstr + pos, NULL);
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kvfree(tmpstr);
        return rc;
 }
 
        if (!*lenp)
                return 0;
 
-       LIBCFS_ALLOC(tmpstr, tmpsiz);
+       tmpstr = kvmalloc(tmpsiz, GFP_KERNEL);
        if (!tmpstr)
                return -ENOMEM;
 
                        *ppos += 1;
        }
 
-       LIBCFS_FREE(tmpstr, tmpsiz);
+       kvfree(tmpstr);
 
        if (!rc)
                *lenp = len;
        int rc;
        int i;
 
-       LIBCFS_ALLOC(buf, buf_len);
+       buf = kmalloc(buf_len, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
        }
        lnet_res_unlock(0);
 out:
-       LIBCFS_FREE(buf, buf_len);
+       kfree(buf);
        return rc;
 }