[master] c638b74b9 Tuesday morning FlexeLinting
Poul-Henning Kamp
phk at FreeBSD.org
Tue Nov 12 09:11:07 UTC 2019
commit c638b74b9ee96d8a7205bd276cd3285c3a4fb107
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Nov 12 09:09:51 2019 +0000
Tuesday morning FlexeLinting
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index a8dcc0395..75bbbe4ad 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -388,7 +388,7 @@ struct busyobj {
* All fields from retries and down are zeroed when the busyobj
* is recycled.
*/
- int retries;
+ unsigned retries;
struct req *req;
struct sess *sp;
struct worker *wrk;
@@ -449,7 +449,7 @@ struct req {
enum req_step req_step;
volatile enum req_body_state_e req_body_status;
enum sess_close doclose;
- int restarts;
+ unsigned restarts;
unsigned esi_level;
struct req *topreq; /* esi_level == 0 request */
struct vcl *vcl0;
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index 1c1f13a04..ed67f0e5f 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -938,7 +938,7 @@ VEP_Parse(struct vep_state *vep, const char *p, size_t l)
vep->match = NULL;
vep->tag_i = 0;
} else {
- assert(e - p <= sizeof(vep->tag));
+ assert(p + sizeof(vep->tag) >= e);
memcpy(vep->tag, p, e - p);
vep->tag_i = e - p;
vep->state = VEP_MATCHBUF;
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 9bffb8855..b98d3e535 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -248,8 +248,8 @@ static struct hsh_magiclist {
static void
hsh_testmagic(void *result)
{
- int i, j;
- static int nused = 0;
+ size_t i, j;
+ static size_t nused = 0;
for (i = 0; i < nused; i++)
if (!memcmp(hsh_magiclist[i].was, result, VSHA256_LEN))
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index c5ad6eb8e..343fc47dc 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -430,7 +430,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo)
VSB_indent(vsb, 2);
PAN_CheckMagic(vsb, bo, BUSYOBJ_MAGIC);
VSB_printf(vsb, "end = %p,\n", bo->end);
- VSB_printf(vsb, "retries = %d,\n", bo->retries);
+ VSB_printf(vsb, "retries = %u,\n", bo->retries);
if (bo->req != NULL)
pan_req(vsb, bo->req);
@@ -526,7 +526,7 @@ pan_req(struct vsb *vsb, const struct req *req)
"err_code = %d, err_reason = %s,\n", req->err_code,
req->err_reason ? req->err_reason : "(null)");
- VSB_printf(vsb, "restarts = %d, esi_level = %u,\n",
+ VSB_printf(vsb, "restarts = %u, esi_level = %u,\n",
req->restarts, req->esi_level);
if (req->sp != NULL)
diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c
index ae924d66e..0fff1dd39 100644
--- a/bin/varnishd/http1/cache_http1_line.c
+++ b/bin/varnishd/http1/cache_http1_line.c
@@ -143,7 +143,7 @@ V1L_Close(struct worker *wrk, uint64_t *cnt)
}
static void
-v1l_prune(struct v1l *v1l, ssize_t bytes)
+v1l_prune(struct v1l *v1l, size_t bytes)
{
ssize_t used = 0;
ssize_t j, used_here;
diff --git a/bin/varnishd/http2/cache_http2.h b/bin/varnishd/http2/cache_http2.h
index 430ab060c..4c263ce04 100644
--- a/bin/varnishd/http2/cache_http2.h
+++ b/bin/varnishd/http2/cache_http2.h
@@ -149,7 +149,7 @@ struct h2_sess {
struct sess *sess;
int refcnt;
- int open_streams;
+ unsigned open_streams;
uint32_t highest_stream;
int bogosity;
int do_sweep;
diff --git a/bin/varnishd/http2/cache_http2_proto.c b/bin/varnishd/http2/cache_http2_proto.c
index 0f2a21230..3803cbc81 100644
--- a/bin/varnishd/http2/cache_http2_proto.c
+++ b/bin/varnishd/http2/cache_http2_proto.c
@@ -906,19 +906,13 @@ static enum htc_status_e v_matchproto_(htc_complete_f)
h2_frame_complete(struct http_conn *htc)
{
struct h2_sess *h2;
- int l;
- unsigned u;
CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
CAST_OBJ_NOTNULL(h2, htc->priv, H2_SESS_MAGIC);
- l = htc->rxbuf_e - htc->rxbuf_b;
- if (l < 9)
+ if (htc->rxbuf_b + 9 > htc->rxbuf_e ||
+ htc->rxbuf_b + 9 + (vbe32dec(htc->rxbuf_b) >> 8) > htc->rxbuf_e)
return (HTC_S_MORE);
- u = vbe32dec(htc->rxbuf_b) >> 8;
- if (l >= u + 9)
- return (HTC_S_COMPLETE);
-
- return (HTC_S_MORE);
+ return (HTC_S_COMPLETE);
}
/**********************************************************************/
More information about the varnish-commit
mailing list