]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] Type the shifted values to isc_uint32_t so the top bit is unsigned (found...
authorOndřej Surý <ondrej@sury.org>
Thu, 30 Nov 2017 17:23:35 +0000 (18:23 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 30 Nov 2017 17:23:35 +0000 (18:23 +0100)
bin/tests/atomic/t_atomic.c
lib/dns/dispatch.c
lib/dns/rbtdb.c
lib/dns/rdata.c
lib/isc/portset.c

index 67ef53354fb11763c548de92768d982070b8f7b4..4f5337dd7f50da1b1ba95a6423498b78a8788164 100644 (file)
@@ -181,7 +181,7 @@ static void
 do_store(isc_task_t *task, isc_event_t *ev) {
        counter_t *state = (counter_t *)ev->ev_arg;
        int i;
-       isc_uint8_t r;
+       isc_uint32_t r;
        isc_uint32_t val;
 
        r = random() % 256;
@@ -205,7 +205,7 @@ test_atomic_store() {
        isc_task_t *tasks[TASKS];
        isc_event_t *event;
        int i;
-       isc_uint8_t r;
+       isc_uint32_t r;
        isc_uint32_t val;
 
        t_assert("test_atomic_store", 1, T_REQUIRED, "%s",
index da40fa626333db3a72a9d25c63f4e2417236637c..5707abd53e57bf34a7ed69a93eefdb9722c5b9b4 100644 (file)
@@ -421,10 +421,10 @@ static isc_uint32_t
 dns_hash(dns_qid_t *qid, const isc_sockaddr_t *dest, dns_messageid_t id,
         in_port_t port)
 {
-       unsigned int ret;
+       isc_uint32_t ret;
 
        ret = isc_sockaddr_hash(dest, ISC_TRUE);
-       ret ^= (id << 16) | port;
+       ret ^= ((isc_uint32_t)id << 16) | port;
        ret %= qid->qid_nbuckets;
 
        INSIST(ret < qid->qid_nbuckets);
index 041d757c110083f66979985e00e666ff991eb2b9..4ff1f4586603558d6862a02edd760a42deb6e1fa 100644 (file)
@@ -307,7 +307,7 @@ typedef isc_uint32_t                    rbtdb_rdatatype_t;
 
 #define RBTDB_RDATATYPE_BASE(type)      ((dns_rdatatype_t)((type) & 0xFFFF))
 #define RBTDB_RDATATYPE_EXT(type)       ((dns_rdatatype_t)((type) >> 16))
-#define RBTDB_RDATATYPE_VALUE(b, e)     ((rbtdb_rdatatype_t)((e) << 16) | (b))
+#define RBTDB_RDATATYPE_VALUE(base, ext)     ((rbtdb_rdatatype_t)(((isc_uint32_t)ext) << 16) | ((isc_uint32_t)base) & 0xffff)
 
 #define RBTDB_RDATATYPE_SIGNSEC \
                RBTDB_RDATATYPE_VALUE(dns_rdatatype_rrsig, dns_rdatatype_nsec)
index 04e02a63a6ba3a010ab41b4e2a8b006897dad0a2..204729c4412172c49cafda99c5ef6168567420b3 100644 (file)
@@ -1796,10 +1796,10 @@ uint32_fromregion(isc_region_t *region) {
        isc_uint32_t value;
 
        REQUIRE(region->length >= 4);
-       value = region->base[0] << 24;
-       value |= region->base[1] << 16;
-       value |= region->base[2] << 8;
-       value |= region->base[3];
+       value = (isc_uint32_t)region->base[0] << 24;
+       value |= (isc_uint32_t)region->base[1] << 16;
+       value |= (isc_uint32_t)region->base[2] << 8;
+       value |= (isc_uint32_t)region->base[3];
        return(value);
 }
 
index 21dfd6d83a90180506252101266a78ac1733ac4f..a5843c1013bcebe7aeebd4c7fec4464f3588d87e 100644 (file)
@@ -32,14 +32,14 @@ struct isc_portset {
 
 static inline isc_boolean_t
 portset_isset(isc_portset_t *portset, in_port_t port) {
-       return (ISC_TF((portset->buf[port >> 5] & (1 << (port & 31))) != 0));
+       return (ISC_TF((portset->buf[port >> 5] & ((isc_uint32_t)1 << (port & 31))) != 0));
 }
 
 static inline void
 portset_add(isc_portset_t *portset, in_port_t port) {
        if (!portset_isset(portset, port)) {
                portset->nports++;
-               portset->buf[port >> 5] |= (1 << (port & 31));
+               portset->buf[port >> 5] |= ((isc_uint32_t)1 << (port & 31));
        }
 }
 
@@ -47,7 +47,7 @@ static inline void
 portset_remove(isc_portset_t *portset, in_port_t port) {
        if (portset_isset(portset, port)) {
                portset->nports--;
-               portset->buf[port >> 5] &= ~(1 << (port & 31));
+               portset->buf[port >> 5] &= ~((isc_uint32_t)1 << (port & 31));
        }
 }