diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c
index dd8c18a5bb7e2ea874c8b778e9a892b4194fdf85..ffb2c41aa4e693b9844f3501ebaacc7d24d95b8a 100644
--- a/lustre/mdt/mdt_lproc.c
+++ b/lustre/mdt/mdt_lproc.c
@@ -192,8 +192,8 @@ static int lprocfs_wr_identity_upcall(struct file *file, const char *buffer,
                 return -EINVAL;
         }
 
-        if (copy_from_user(kernbuf, buffer,
-                           min(count, UC_CACHE_UPCALL_MAXPATH - 1)))
+        if (copy_from_user(kernbuf, buffer, min_t(unsigned long, count,
+                                                  UC_CACHE_UPCALL_MAXPATH - 1)))
                 return -EFAULT;
 
         /* Remove any extraneous bits from the upcall (e.g. linefeeds) */