]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: Ignore coverity errors
authorRoy Marples <roy@marples.name>
Fri, 3 May 2019 15:27:35 +0000 (16:27 +0100)
committerRoy Marples <roy@marples.name>
Fri, 3 May 2019 15:27:35 +0000 (16:27 +0100)
We could do ((char *)rtm) + rtm->rtm_msglen but that looks
more ugly than rtm + 1.

src/dhcpcd.c
src/if-bsd.c

index 67dc3d646f9998f96bfc27c759ffb3f5e7852154..5907fbbe6a8c63bf3261390d8e9148ec9cd370a1 100644 (file)
@@ -1081,7 +1081,8 @@ dhcpcd_handlelink(void *arg)
                        dhcpcd_linkoverflow(ctx);
                        return;
                }
-               logerr(__func__);
+               if (errno != ENOTSUP)
+                       logerr(__func__);
        }
 }
 
index 5318bdfff2c8976b6bc8f9db358c13956b9d2721..b93aa20786acbd121fac8900bc11cfbd252a44de 100644 (file)
@@ -655,6 +655,9 @@ if_copyrt(struct dhcpcd_ctx *ctx, struct rt *rt, const struct rt_msghdr *rtm)
        }
 #endif
 
+       /* We have already checked that at least one address must be
+        * present after the rtm structure. */
+       /* coverity[ptr_arith] */
        if (get_addrs(rtm->rtm_addrs, rtm + 1,
                      rtm->rtm_msglen - sizeof(*rtm), rti_info) == -1)
                return -1;
@@ -1099,14 +1102,17 @@ if_ifa(struct dhcpcd_ctx *ctx, const struct ifa_msghdr *ifam)
                errno = EINVAL;
                return -1;
        }
-
+       if (~ifam->ifam_addrs & RTA_IFA)
+               return 0;
        if ((ifp = if_findindex(ctx->ifaces, ifam->ifam_index)) == NULL)
                return 0;
+
+       /* We have already checked that at least one address must be
+        * present after the ifam structure. */
+       /* coverity[ptr_arith] */
        if (get_addrs(ifam->ifam_addrs, ifam + 1,
                      ifam->ifam_msglen - sizeof(*ifam), rti_info) == -1)
                return -1;
-       if (rti_info[RTAX_IFA] == NULL)
-               return 0;
 
 #ifdef HAVE_IFAM_PID
        pid = ifam->ifam_pid;
@@ -1302,6 +1308,8 @@ if_dispatch(struct dhcpcd_ctx *ctx, const struct rt_msghdr *rtm)
                return dhcpcd_linkoverflow(ctx);
 #endif
        }
+
+       return 0;
 }
 
 int