--- initial
+++ final
@@ -1,162 +1,162 @@
 int lnet_parse_networks(struct list_head *nilist, char *networks) {
   struct cfs_expr_list *el = NULL;
   int tokensize;
   char *tokens;
   char *str;
   char *tmp;
   struct lnet_ni *ni;
   __u32 net;
   int nnets = 0;
   struct list_head *temp_node;
   if (!networks) {
     CERROR("networks string is undefined\n");
     return -EINVAL;
   }
   if (strlen(networks) > LNET_SINGLE_TEXTBUF_NOB) {
     /* _WAY_ conservative */
     LCONSOLE_ERROR_MSG(0x112, "Can't parse networks: string too long\n");
     return -EINVAL;
   }
   tokensize = strlen(networks) + 1;
-  LIBCFS_ALLOC(tokens, tokensize);
+  tokens = kmalloc(tokensize, GFP_NOFS);
   if (!tokens) {
     CERROR("Can't allocate net tokens\n");
     return -ENOMEM;
   }
   memcpy(tokens, networks, tokensize);
   tmp = tokens;
   str = tokens;
   while (str && *str) {
     char *comma = strchr(str, ',');
     char *bracket = strchr(str, '(');
     char *square = strchr(str, '[');
     char *iface;
     int niface;
     int rc;
     /*
      * NB we don't check interface conflicts here; it's the LNDs
      * responsibility (if it cares at all)
      */
     if (square && (!comma || square < comma)) {
       /*
        * i.e: o2ib0(ib0)[1,2], number between square
        * brackets are CPTs this NI needs to be bond
        */
       if (bracket && bracket > square) {
         tmp = square;
         goto failed_syntax;
       }
       tmp = strchr(square, ']');
       if (!tmp) {
         tmp = square;
         goto failed_syntax;
       }
       rc = cfs_expr_list_parse(square, tmp - square + 1, 0, LNET_CPT_NUMBER - 1, &el);
       if (rc) {
         tmp = square;
         goto failed_syntax;
       }
       while (square <= tmp)
         *square++ = ' ';
     }
     if (!bracket || (comma && comma < bracket)) {
       /* no interface list specified */
       if (comma) *comma++ = 0;
       net = libcfs_str2net(strim(str));
       if (net == LNET_NIDNET(LNET_NID_ANY)) {
         LCONSOLE_ERROR_MSG(0x113, "Unrecognised network type\n");
         tmp = str;
         goto failed_syntax;
       }
       if (LNET_NETTYP(net) != LOLND && /* LO is implicit */
           !lnet_ni_alloc(net, el, nilist))
         goto failed;
       if (el) {
         cfs_expr_list_free(el);
         el = NULL;
       }
       str = comma;
       continue;
     }
     *bracket = 0;
     net = libcfs_str2net(strim(str));
     if (net == LNET_NIDNET(LNET_NID_ANY)) {
       tmp = str;
       goto failed_syntax;
     }
     ni = lnet_ni_alloc(net, el, nilist);
     if (!ni) goto failed;
     if (el) {
       cfs_expr_list_free(el);
       el = NULL;
     }
     niface = 0;
     iface = bracket + 1;
     bracket = strchr(iface, ')');
     if (!bracket) {
       tmp = iface;
       goto failed_syntax;
     }
     *bracket = 0;
     do {
       comma = strchr(iface, ',');
       if (comma) *comma++ = 0;
       iface = strim(iface);
       if (!*iface) {
         tmp = iface;
         goto failed_syntax;
       }
       if (niface == LNET_MAX_INTERFACES) {
         LCONSOLE_ERROR_MSG(0x115, "Too many interfaces for net %s\n", libcfs_net2str(net));
         goto failed;
       }
       /*
        * Allocate a separate piece of memory and copy
        * into it the string, so we don't have
        * a depencency on the tokens string.  This way we
        * can free the tokens at the end of the function.
        * The newly allocated ni_interfaces[] can be
        * freed when freeing the NI
        */
-      LIBCFS_ALLOC(ni->ni_interfaces[niface], strlen(iface) + 1);
+      ni->ni_interfaces[niface] = kmalloc(strlen(iface) + 1, GFP_NOFS);
       if (!ni->ni_interfaces[niface]) {
         CERROR("Can't allocate net interface name\n");
         goto failed;
       }
       strncpy(ni->ni_interfaces[niface], iface, strlen(iface));
       niface++;
       iface = comma;
     } while (iface);
     str = bracket + 1;
     comma = strchr(bracket + 1, ',');
     if (comma) {
       *comma = 0;
       str = strim(str);
       if (*str) {
         tmp = str;
         goto failed_syntax;
       }
       str = comma + 1;
       continue;
     }
     str = strim(str);
     if (*str) {
       tmp = str;
       goto failed_syntax;
     }
   }
   list_for_each(temp_node, nilist) nnets++;
-  LIBCFS_FREE(tokens, tokensize);
+  kfree(tokens);
   return nnets;
 failed_syntax:
   lnet_syntax("networks", networks, (int)(tmp - tokens), strlen(tmp));
 failed:
   while (!list_empty(nilist)) {
     ni = list_entry(nilist->next, struct lnet_ni, ni_list);
     list_del(&ni->ni_list);
     lnet_ni_free(ni);
   }
   if (el) cfs_expr_list_free(el);
-  LIBCFS_FREE(tokens, tokensize);
+  kfree(tokens);
   return -EINVAL;
 }<sep>@@
expression buf,data;
@@
-	LIBCFS_ALLOC(buf, data);
+	buf = kmalloc(data, GFP_NOFS);

@@
expression buf,data;
@@
-		LIBCFS_FREE(buf, data);
+		kfree(buf);