]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Explain to Coverity why overrunning sockaddr_ll for IPoIB interfaces can happen and...
authorRoy Marples <roy@marples.name>
Tue, 3 May 2016 10:55:57 +0000 (10:55 +0000)
committerRoy Marples <roy@marples.name>
Tue, 3 May 2016 10:55:57 +0000 (10:55 +0000)
if-linux.c

index bd6baaae71bf04f77a8f9df7ee706311f1b9e4e1..3f526f3e22effb2d5792fd25371916710d7ede76 100644 (file)
@@ -1286,10 +1286,15 @@ if_sendrawpacket(const struct interface *ifp, uint16_t protocol,
        su.sll.sll_ifindex = (int)ifp->index;
        su.sll.sll_hatype = htons(ifp->family);
        su.sll.sll_halen = (unsigned char)ifp->hwlen;
-       if (ifp->family == ARPHRD_INFINIBAND)
+       if (ifp->family == ARPHRD_INFINIBAND) {
+               /* sockaddr_ll is not big enough for IPoIB which is why
+                * sockaddr_storage is included in the union.
+                * Ugly as sin, but it works. */
+               /* coverity[buffer-size] */
+               /* coverity[overrun-buffer-arg] */
                memcpy(&su.sll.sll_addr,
                    &ipv4_bcast_addr, sizeof(ipv4_bcast_addr));
-       else
+       else
                memset(&su.sll.sll_addr, 0xff, ifp->hwlen);
        fd = ipv4_protocol_fd(ifp, protocol);