Skip to content

Commit

Permalink
tools: fix scan-build warnings in scmp_bpf_disasm
Browse files Browse the repository at this point in the history
Delete the unused variable 'len' from scmp_bpf_disasm.

scan-build identified the following two warnings:

    scmp_bpf_disasm.c:304:10: warning: Although the value stored to 'len'
    is used in the enclosing expression, the value is never actually read
    from 'len'
            while ((len = fread(&bpf, sizeof(bpf), 1, file))) {

    scmp_bpf_disasm.c:441:10: warning: Although the value stored to 'len' is
    used in the enclosing expression, the value is never actually read from
    'len'
            while ((len = fread(&bpf, sizeof(bpf), 1, file))) {

Signed-off-by: Tom Hromatka <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
drakenclimber authored and pcmoore committed Jul 27, 2021
1 parent dc775c0 commit 947ecc8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/scmp_bpf_disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,13 @@ static void bpf_decode_args(const bpf_instr_raw *bpf, unsigned int line)
static int bpf_decode(FILE *file)
{
unsigned int line = 0;
size_t len;
bpf_instr_raw bpf;

/* header */
printf(" line OP JT JF K\n");
printf("=================================\n");

while ((len = fread(&bpf, sizeof(bpf), 1, file))) {
while (fread(&bpf, sizeof(bpf), 1, file)) {
/* convert the bpf statement */
bpf.code = ttoh16(arch, bpf.code);
bpf.k = ttoh32(arch, bpf.k);
Expand Down Expand Up @@ -430,15 +429,14 @@ static void bpf_dot_decode_args(const bpf_instr_raw *bpf, unsigned int line)
static int bpf_dot_decode(FILE *file)
{
unsigned int line = 0;
size_t len;
bpf_instr_raw bpf;
int prev_class = 0;

/* header */
printf("digraph {\n");
printf("\tstart[shape=\"box\", style=rounded];\n");

while ((len = fread(&bpf, sizeof(bpf), 1, file))) {
while (fread(&bpf, sizeof(bpf), 1, file)) {
/* convert the bpf statement */
bpf.code = ttoh16(arch, bpf.code);
bpf.k = ttoh32(arch, bpf.k);
Expand Down

0 comments on commit 947ecc8

Please sign in to comment.