--- initial
+++ final
@@ -1,125 +1,125 @@
 static int lnet_ping(struct lnet_process_id id, int timeout_ms, struct lnet_process_id __user *ids, int n_ids) {
   struct lnet_handle_eq eqh;
   struct lnet_handle_md mdh;
   struct lnet_event event;
   struct lnet_md md = {NULL};
   int which;
   int unlinked = 0;
   int replied = 0;
   const int a_long_time = 60000; /* mS */
   int infosz;
   struct lnet_ping_info *info;
   struct lnet_process_id tmpid;
   int i;
   int nob;
   int rc;
   int rc2;
   sigset_t blocked;
   infosz = offsetof(struct lnet_ping_info, pi_ni[n_ids]);
   if (n_ids <= 0 || id.nid == LNET_NID_ANY || timeout_ms > 500000 || /* arbitrary limit! */
       n_ids > 20)                                                    /* arbitrary limit! */
     return -EINVAL;
   if (id.pid == LNET_PID_ANY) id.pid = LNET_PID_LUSTRE;
-  LIBCFS_ALLOC(info, infosz);
+  info = kmalloc(infosz, GFP_NOFS);
   if (!info) return -ENOMEM;
   /* NB 2 events max (including any unlink event) */
   rc = LNetEQAlloc(2, LNET_EQ_HANDLER_NONE, &eqh);
   if (rc) {
     CERROR("Can't allocate EQ: %d\n", rc);
     goto out_0;
   }
   /* initialize md content */
   md.start = info;
   md.length = infosz;
   md.threshold = 2; /*GET/REPLY*/
   md.max_size = 0;
   md.options = LNET_MD_TRUNCATE;
   md.user_ptr = NULL;
   md.eq_handle = eqh;
   rc = LNetMDBind(md, LNET_UNLINK, &mdh);
   if (rc) {
     CERROR("Can't bind MD: %d\n", rc);
     goto out_1;
   }
   rc = LNetGet(LNET_NID_ANY, mdh, id, LNET_RESERVED_PORTAL, LNET_PROTO_PING_MATCHBITS, 0);
   if (rc) {
     /* Don't CERROR; this could be deliberate! */
     rc2 = LNetMDUnlink(mdh);
     LASSERT(!rc2);
     /* NB must wait for the UNLINK event below... */
     unlinked = 1;
     timeout_ms = a_long_time;
   }
   do {
     /* MUST block for unlink to complete */
     if (unlinked) blocked = cfs_block_allsigs();
     rc2 = LNetEQPoll(&eqh, 1, timeout_ms, &event, &which);
     if (unlinked) cfs_restore_sigs(blocked);
     CDEBUG(D_NET, "poll %d(%d %d)%s\n", rc2, (rc2 <= 0) ? -1 : event.type, (rc2 <= 0) ? -1 : event.status, (rc2 > 0 && event.unlinked) ? " unlinked" : "");
     LASSERT(rc2 != -EOVERFLOW); /* can't miss anything */
     if (rc2 <= 0 || event.status) {
       /* timeout or error */
       if (!replied && !rc) rc = (rc2 < 0) ? rc2 : !rc2 ? -ETIMEDOUT : event.status;
       if (!unlinked) {
         /* Ensure completion in finite time... */
         LNetMDUnlink(mdh);
         /* No assertion (racing with network) */
         unlinked = 1;
         timeout_ms = a_long_time;
       } else if (!rc2) {
         /* timed out waiting for unlink */
         CWARN("ping %s: late network completion\n", libcfs_id2str(id));
       }
     } else if (event.type == LNET_EVENT_REPLY) {
       replied = 1;
       rc = event.mlength;
     }
   } while (rc2 <= 0 || !event.unlinked);
   if (!replied) {
     if (rc >= 0) CWARN("%s: Unexpected rc >= 0 but no reply!\n", libcfs_id2str(id));
     rc = -EIO;
     goto out_1;
   }
   nob = rc;
   LASSERT(nob >= 0 && nob <= infosz);
   rc = -EPROTO; /* if I can't parse... */
   if (nob < 8) {
     /* can't check magic/version */
     CERROR("%s: ping info too short %d\n", libcfs_id2str(id), nob);
     goto out_1;
   }
   if (info->pi_magic == __swab32(LNET_PROTO_PING_MAGIC)) {
     lnet_swap_pinginfo(info);
   } else if (info->pi_magic != LNET_PROTO_PING_MAGIC) {
     CERROR("%s: Unexpected magic %08x\n", libcfs_id2str(id), info->pi_magic);
     goto out_1;
   }
   if (!(info->pi_features & LNET_PING_FEAT_NI_STATUS)) {
     CERROR("%s: ping w/o NI status: 0x%x\n", libcfs_id2str(id), info->pi_features);
     goto out_1;
   }
   if (nob < offsetof(struct lnet_ping_info, pi_ni[0])) {
     CERROR("%s: Short reply %d(%d min)\n", libcfs_id2str(id), nob, (int)offsetof(struct lnet_ping_info, pi_ni[0]));
     goto out_1;
   }
   if (info->pi_nnis < n_ids) n_ids = info->pi_nnis;
   if (nob < offsetof(struct lnet_ping_info, pi_ni[n_ids])) {
     CERROR("%s: Short reply %d(%d expected)\n", libcfs_id2str(id), nob, (int)offsetof(struct lnet_ping_info, pi_ni[n_ids]));
     goto out_1;
   }
   rc = -EFAULT; /* If I SEGV... */
   memset(&tmpid, 0, sizeof(tmpid));
   for (i = 0; i < n_ids; i++) {
     tmpid.pid = info->pi_pid;
     tmpid.nid = info->pi_ni[i].ns_nid;
     if (copy_to_user(&ids[i], &tmpid, sizeof(tmpid))) goto out_1;
   }
   rc = info->pi_nnis;
 out_1:
   rc2 = LNetEQFree(eqh);
   if (rc2) CERROR("rc2 %d\n", rc2);
   LASSERT(!rc2);
 out_0:
-  LIBCFS_FREE(info, infosz);
+  kfree(info);
   return rc;
 }<sep>@@
expression buf,data;
@@
-	LIBCFS_ALLOC(buf, data);
+	buf = kmalloc(data, GFP_NOFS);

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