Commit b223e3b4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Daniel Borkmann

tools/bpf_jit_disasm: silence a static checker warning

There is a static checker warning that "proglen" has an upper bound but
no lower bound.  The allocation will just fail harmlessly so it's not a
big deal.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent cb5f7334
...@@ -172,7 +172,8 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen, ...@@ -172,7 +172,8 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
{ {
char *ptr, *pptr, *tmp; char *ptr, *pptr, *tmp;
off_t off = 0; off_t off = 0;
int ret, flen, proglen, pass, ulen = 0; unsigned int proglen;
int ret, flen, pass, ulen = 0;
regmatch_t pmatch[1]; regmatch_t pmatch[1];
unsigned long base; unsigned long base;
regex_t regex; regex_t regex;
...@@ -199,7 +200,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen, ...@@ -199,7 +200,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
} }
ptr = haystack + off - (pmatch[0].rm_eo - pmatch[0].rm_so); ptr = haystack + off - (pmatch[0].rm_eo - pmatch[0].rm_so);
ret = sscanf(ptr, "flen=%d proglen=%d pass=%d image=%lx", ret = sscanf(ptr, "flen=%d proglen=%u pass=%d image=%lx",
&flen, &proglen, &pass, &base); &flen, &proglen, &pass, &base);
if (ret != 4) { if (ret != 4) {
regfree(&regex); regfree(&regex);
...@@ -239,7 +240,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen, ...@@ -239,7 +240,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
} }
assert(ulen == proglen); assert(ulen == proglen);
printf("%d bytes emitted from JIT compiler (pass:%d, flen:%d)\n", printf("%u bytes emitted from JIT compiler (pass:%d, flen:%d)\n",
proglen, pass, flen); proglen, pass, flen);
printf("%lx + <x>:\n", base); printf("%lx + <x>:\n", base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment