}
 EXPORT_SYMBOL_GPL(svc_unreg_xprt_class);
 
-/*
- * Format the transport list for printing
+/**
+ * svc_print_xprts - Format the transport list for printing
+ * @buf: target buffer for formatted address
+ * @maxlen: length of target buffer
+ *
+ * Fills in @buf with a string containing a list of transport names, each name
+ * terminated with '\n'. If the buffer is too small, some entries may be
+ * missing, but it is guaranteed that all lines in the output buffer are
+ * complete.
+ *
+ * Returns positive length of the filled-in string.
  */
 int svc_print_xprts(char *buf, int maxlen)
 {
        list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) {
                int slen;
 
-               sprintf(tmpstr, "%s %d\n", xcl->xcl_name, xcl->xcl_max_payload);
-               slen = strlen(tmpstr);
-               if (len + slen > maxlen)
+               slen = snprintf(tmpstr, sizeof(tmpstr), "%s %d\n",
+                               xcl->xcl_name, xcl->xcl_max_payload);
+               if (slen >= sizeof(tmpstr) || len + slen >= maxlen)
                        break;
                len += slen;
                strcat(buf, tmpstr);