[openib-general] [PATCH] mad: Add port number to MAD thread names
Roland Dreier
roland at topspin.com
Thu Nov 18 09:23:47 PST 2004
It's extremely unlikely, but:
+ char name[8];
+ sprintf(name, "ib_mad%d", port_num);
if port_num >= 10, this will overflow the buffer. Since a device
could conceivably have up to 255 ports (although an HCA with hundreds
of ports is rather far-fetched, and we only create one port for a
switch), I would suggest doing
char name[sizeof "ib_mad123"];
and
snprintf(name, sizeof name, "ib_mad%d", port_num);
for correctness and (mostly) ease of auditing.
- Roland
More information about the general
mailing list