tcp: warn if offset reach the maxlen limit when using snprintf
[linux-2.6-microblaze.git] / net / ipv4 / tcp_ulp.c
index 4849edb..12ab5db 100644 (file)
@@ -92,6 +92,9 @@ void tcp_get_available_ulp(char *buf, size_t maxlen)
                offs += snprintf(buf + offs, maxlen - offs,
                                 "%s%s",
                                 offs == 0 ? "" : " ", ulp_ops->name);
+
+               if (WARN_ON_ONCE(offs >= maxlen))
+                       break;
        }
        rcu_read_unlock();
 }