Skip to content

Commit b223e3b

Browse files
Dan Carpenterborkmann
authored andcommitted
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: Dan Carpenter <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent cb5f733 commit b223e3b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/bpf/bpf_jit_disasm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
172172
{
173173
char *ptr, *pptr, *tmp;
174174
off_t off = 0;
175-
int ret, flen, proglen, pass, ulen = 0;
175+
unsigned int proglen;
176+
int ret, flen, pass, ulen = 0;
176177
regmatch_t pmatch[1];
177178
unsigned long base;
178179
regex_t regex;
@@ -199,7 +200,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
199200
}
200201

201202
ptr = haystack + off - (pmatch[0].rm_eo - pmatch[0].rm_so);
202-
ret = sscanf(ptr, "flen=%d proglen=%d pass=%d image=%lx",
203+
ret = sscanf(ptr, "flen=%d proglen=%u pass=%d image=%lx",
203204
&flen, &proglen, &pass, &base);
204205
if (ret != 4) {
205206
regfree(&regex);
@@ -239,7 +240,7 @@ static uint8_t *get_last_jit_image(char *haystack, size_t hlen,
239240
}
240241

241242
assert(ulen == proglen);
242-
printf("%d bytes emitted from JIT compiler (pass:%d, flen:%d)\n",
243+
printf("%u bytes emitted from JIT compiler (pass:%d, flen:%d)\n",
243244
proglen, pass, flen);
244245
printf("%lx + <x>:\n", base);
245246

0 commit comments

Comments
 (0)