]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Cast away more gcc errors.
authorRoy Marples <roy@marples.name>
Fri, 13 Mar 2015 21:26:20 +0000 (21:26 +0000)
committerRoy Marples <roy@marples.name>
Fri, 13 Mar 2015 21:26:20 +0000 (21:26 +0000)
ipv6.c
ipv6nd.c

diff --git a/ipv6.c b/ipv6.c
index b5f836a1349db84ce2e7902653305db270795d73..7969c4103947989dec934c33c5889640bdc9a4d3 100644 (file)
--- a/ipv6.c
+++ b/ipv6.c
@@ -454,7 +454,8 @@ ipv6_makeprefix(struct in6_addr *prefix, const struct in6_addr *addr, int len)
        bitlen = len % NBBY;
        memcpy(&prefix->s6_addr, &addr->s6_addr, (size_t)bytelen);
        if (bitlen != 0)
-               prefix->s6_addr[bytelen] >>= NBBY - bitlen;
+               prefix->s6_addr[bytelen] =
+                   (uint8_t)(prefix->s6_addr[bytelen] >> (NBBY - bitlen));
        memset((char *)prefix->s6_addr + bytelen, 0,
            sizeof(prefix->s6_addr) - (size_t)bytelen);
        return 0;
@@ -1406,7 +1407,7 @@ again:
        /* RFC4941 Section 3.2.1.1
         * Take the left-most 64bits and set bit 6 to zero */
        memcpy(state->randomid, digest, sizeof(state->randomid));
-       state->randomid[0] &= ~EUI64_UBIT;
+       state->randomid[0] = (uint8_t)(state->randomid[0] & ~EUI64_UBIT);
 
        /* RFC4941 Section 3.2.1.4
         * Reject reserved or existing id's */
index 140ba184b4105ab88164a340debec53c2254cc27..e11b86a331c505c525833f8446a20de6475cd669 100644 (file)
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -237,7 +237,7 @@ ipv6nd_makersprobe(struct interface *ifp)
 
        state = RS_STATE(ifp);
        free(state->rs);
-       state->rslen = sizeof(*rs) + ROUNDUP8(ifp->hwlen + 2);
+       state->rslen = sizeof(*rs) + (size_t)ROUNDUP8(ifp->hwlen + 2);
        state->rs = calloc(1, state->rslen);
        if (state->rs == NULL)
                return -1;
@@ -816,7 +816,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                        break;
                }
                ndo = (struct nd_opt_hdr *)p;
-               olen = ndo->nd_opt_len * 8 ;
+               olen = (size_t)ndo->nd_opt_len * 8;
                if (olen == 0) {
                        syslog(LOG_ERR, "%s: zero length option", ifp->name);
                        break;
@@ -988,7 +988,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                            nd_opt_rdnss_lifetime);
                        op += sizeof(rdnss->nd_opt_rdnss_lifetime);
                        l = 0;
-                       for (n = ndo->nd_opt_len - 1; n > 1; n -= 2,
+                       for (n = (size_t)ndo->nd_opt_len - 1; n > 1; n -= 2,
                            op += sizeof(addr))
                        {
                                r = ipv6_printaddr(NULL, 0, op, ifp->name);
@@ -1002,7 +1002,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                        tmp = opt = malloc(l);
                        if (opt == NULL)
                                continue;
-                       for (n = ndo->nd_opt_len - 1; n > 1; n -= 2,
+                       for (n = (size_t)ndo->nd_opt_len - 1; n > 1; n -= 2,
                            op += sizeof(addr))
                        {
                                r = ipv6_printaddr(tmp, l, op,
@@ -1025,7 +1025,7 @@ ipv6nd_handlera(struct ipv6_ctx *ctx, struct interface *ifp,
                        op = p + offsetof(struct nd_opt_dnssl,
                            nd_opt_dnssl_lifetime);
                        op += sizeof(dnssl->nd_opt_dnssl_lifetime);
-                       n = (dnssl->nd_opt_dnssl_len - 1) * 8;
+                       n = (size_t)(dnssl->nd_opt_dnssl_len - 1) * 8;
                        r = decode_rfc3397(NULL, 0, op, n);
                        if (r < 1) {
                                syslog(new_data ? LOG_ERR : LOG_DEBUG,