Can I suggest something more like this:
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index de3c077733a7..0292f45b70f6 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -115,16 +115,9 @@ int svc_print_xprts(char *buf, int maxlen)
buf[0] = '\0';
spin_lock(&svc_xprt_class_lock);
- 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)
- break;
- len += slen;
- strcat(buf, tmpstr);
- }
+ list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list)
+ len += scnprintf(buf + len, maxlen - len, "%s %d\n",
+ xcl->xcl_name, xcl->xcl_max_payload);
spin_unlock(&svc_xprt_class_lock);
return len;
NeilBrown