src/http/modules/ngx_http_upstream_hash_module.c:264: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned64 by call to `ngx_rwlock_unlock`.

src/http/modules/ngx_http_upstream_hash_module.c:179:5: Call
177.                    "get hash peer, try: %ui", pc->tries);
178. 
179.     ngx_http_upstream_rr_peers_wlock(hp->rrp.peers);
         ^
180. 
181.     if (hp->tries > 20 || hp->rrp.peers->single) {

src/core/ngx_rwlock.c:19:1: Parameter `*lock`
  17. 
  18. 
  19. void
      ^
  20. ngx_rwlock_wlock(ngx_atomic_t *lock)
  21. {

src/http/modules/ngx_http_upstream_hash_module.c:264:13: Call
262. 
263.         if (++hp->tries > 20) {
264.             ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);
                 ^
265.             return hp->get_rr_peer(pc, &hp->rrp);
266.         }

src/core/ngx_rwlock.c:89:1: <LHS trace>
87. 
88. 
89. void
    ^
90. ngx_rwlock_unlock(ngx_atomic_t *lock)
91. {

src/core/ngx_rwlock.c:89:1: Parameter `*lock`
  87. 
  88. 
  89. void
      ^
  90. ngx_rwlock_unlock(ngx_atomic_t *lock)
  91. {

src/core/ngx_rwlock.c:94:5: Assignment
  92.     ngx_atomic_uint_t  readers;
  93. 
  94.     readers = *lock;
          ^
  95. 
  96.     if (readers == NGX_RWLOCK_WLOCK) {

src/core/ngx_rwlock.c:103:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_rwlock_unlock` 
  101.     for ( ;; ) {
  102. 
  103.         if (ngx_atomic_cmp_set(lock, readers, readers - 1)) {
                   ^
  104.             return;
  105.         }

void
ngx_rwlock_unlock(ngx_atomic_t *lock)
{
    ngx_atomic_uint_t  readers;
    readers = *lock;
    if (readers == NGX_RWLOCK_WLOCK) {
        *lock = 0;
        return;
    }
    for ( ;; ) {
        if (ngx_atomic_cmp_set(lock, readers, readers - 1)) {
            return;
        }
        readers = *lock;
    }
}
['static ngx_int_t\nngx_http_upstream_get_hash_peer(ngx_peer_connection_t *pc, void *data)\n{\n    ngx_http_upstream_hash_peer_data_t  *hp = data;\n    time_t                        now;\n    u_char                        buf[NGX_INT_T_LEN];\n    size_t                        size;\n    uint32_t                      hash;\n    ngx_int_t                     w;\n    uintptr_t                     m;\n    ngx_uint_t                    i, n, p;\n    ngx_http_upstream_rr_peer_t  *peer;\n    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,\n                   "get hash peer, try: %ui", pc->tries);\n    ngx_http_upstream_rr_peers_wlock(hp->rrp.peers);\n    if (hp->tries > 20 || hp->rrp.peers->single) {\n        ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);\n        return hp->get_rr_peer(pc, &hp->rrp);\n    }\n    now = ngx_time();\n    pc->cached = 0;\n    pc->connection = NULL;\n    for ( ;; ) {\n        ngx_crc32_init(hash);\n        if (hp->rehash > 0) {\n            size = ngx_sprintf(buf, "%ui", hp->rehash) - buf;\n            ngx_crc32_update(&hash, buf, size);\n        }\n        ngx_crc32_update(&hash, hp->key.data, hp->key.len);\n        ngx_crc32_final(hash);\n        hash = (hash >> 16) & 0x7fff;\n        hp->hash += hash;\n        hp->rehash++;\n        if (!hp->rrp.peers->weighted) {\n            p = hp->hash % hp->rrp.peers->number;\n            peer = hp->rrp.peers->peer;\n            for (i = 0; i < p; i++) {\n                peer = peer->next;\n            }\n        } else {\n            w = hp->hash % hp->rrp.peers->total_weight;\n            for (peer = hp->rrp.peers->peer, i = 0;\n                 peer;\n                 peer = peer->next, i++)\n            {\n                w -= peer->weight;\n                if (w < 0) {\n                    break;\n                }\n            }\n            p = i;\n        }\n        n = p / (8 * sizeof(uintptr_t));\n        m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t));\n        if (hp->rrp.tried[n] & m) {\n            goto next;\n        }\n        ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,\n                       "get hash peer, value:%uD, peer:%ui", hp->hash, p);\n        if (peer->down) {\n            goto next;\n        }\n        if (peer->max_fails\n            && peer->fails >= peer->max_fails\n            && now - peer->checked <= peer->fail_timeout)\n        {\n            goto next;\n        }\n        break;\n    next:\n        if (++hp->tries > 20) {\n            ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);\n            return hp->get_rr_peer(pc, &hp->rrp);\n        }\n    }\n    hp->rrp.current = peer;\n    pc->sockaddr = peer->sockaddr;\n    pc->socklen = peer->socklen;\n    pc->name = &peer->name;\n    peer->conns++;\n    if (now - peer->checked > peer->fail_timeout) {\n        peer->checked = now;\n    }\n    ngx_http_upstream_rr_peers_unlock(hp->rrp.peers);\n    hp->rrp.tried[n] |= m;\n    return NGX_OK;\n}', 'void\nngx_rwlock_wlock(ngx_atomic_t *lock)\n{\n    ngx_uint_t  i, n;\n    for ( ;; ) {\n        if (*lock == 0 && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK)) {\n            return;\n        }\n        if (ngx_ncpu > 1) {\n            for (n = 1; n < NGX_RWLOCK_SPIN; n <<= 1) {\n                for (i = 0; i < n; i++) {\n                    ngx_cpu_pause();\n                }\n                if (*lock == 0\n                    && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK))\n                {\n                    return;\n                }\n            }\n        }\n        ngx_sched_yield();\n    }\n}', 'void\nngx_rwlock_unlock(ngx_atomic_t *lock)\n{\n    ngx_atomic_uint_t  readers;\n    readers = *lock;\n    if (readers == NGX_RWLOCK_WLOCK) {\n        *lock = 0;\n        return;\n    }\n    for ( ;; ) {\n        if (ngx_atomic_cmp_set(lock, readers, readers - 1)) {\n            return;\n        }\n        readers = *lock;\n    }\n}']