- if (strncmp(tmpbuf, "nid:", 4) != 0)
- return lprocfs_wr_evict_client(file, buffer, count, data);
+ /*
+ * OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
+ * bytes into kbuf, to ensure that the string is NUL-terminated.
+ * UUID_MAX should include a trailing NUL already.
+ */
+ if (cfs_copy_from_user(kbuf, buffer,
+ min_t(unsigned long, BUFLEN - 1, count))) {
+ count = -EFAULT;
+ goto out;
+ }
+ tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
+
+ if (strncmp(tmpbuf, "nid:", 4) != 0) {
+ count = lprocfs_wr_evict_client(file, buffer, count, data);
+ goto out;
+ }