yshigeru / linux-devel

Linux kernel source tree
Other
0 stars 0 forks source link

tipc: tipc_udp_addr2str() should return 1 if invalid UDP media address #39

Closed yshigeru closed 4 months ago

yshigeru commented 4 months ago

tipc_udp_addr2str()は不正なUDPアドレスのとき1を返すべき:

/* tipc_udp_addr2str - convert ip/udp address to string */
static int tipc_udp_addr2str(struct tipc_media_addr *a, char *buf, int size)
{
    struct udp_media_addr *ua = (struct udp_media_addr *)&a->value;

    if (ntohs(ua->proto) == ETH_P_IP)
        snprintf(buf, size, "%pI4:%u", &ua->ipv4, ntohs(ua->port));
    else if (ntohs(ua->proto) == ETH_P_IPV6)
        snprintf(buf, size, "%pI6:%u", &ua->ipv6, ntohs(ua->port));
    else
        pr_err("Invalid UDP media address\n");
    return 0;
}
yshigeru commented 4 months ago

Sent v1 patch: https://lore.kernel.org/all/20240716020905.291388-1-syoshida@redhat.com/

yshigeru commented 4 months ago

Merged on net tree: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=fa96c6baef1b5385e2f0c0677b32b3839e716076