> +void ib_build_node_desc(char *dest, char *src, int dest_len,
> + struct ib_device *dev)
> +{
> + char *end = dest + dest_len-1;
> + char *field;
> +
> + while (*src && (dest < end)) {
> + if (*src != '%') {
> + *dest++ = *src++;
> + } else {
> + src++;
> + switch (*src) {
> + case 'h':
> + field = init_utsname()->nodename;
> + src++;
> + while (*field && (*field != '.') && (dest <
> end))
> + *dest++ = *field++;
> + break;
Indentation is off
> + case 'd':
> + field = dev->name;
> + src++;
> + while (*field && (dest < end))
> + *dest++ = *field++;
> + break;
> + default:
> + src++;
> + }
> + }
src++ is called in every case and could be moved outside
> + }
> + if (dest < end)
> + *dest = 0;
> + else
> + *end = 0;
*dest = '\0'; should be sufficient in all cases
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html