• Peter Oskolkov's avatar
    bpf: fix a (false) compiler warning · d0b2818e
    Peter Oskolkov authored
    An older GCC compiler complains:
    
    kernel/bpf/verifier.c: In function 'bpf_check':
    kernel/bpf/verifier.c:4***:13: error: 'prev_offset' may be used uninitialized
          in this function [-Werror=maybe-uninitialized]
       } else if (krecord[i].insn_offset <= prev_offset) {
                 ^
    kernel/bpf/verifier.c:4***:38: note: 'prev_offset' was declared here
      u32 i, nfuncs, urec_size, min_size, prev_offset;
    
    Although the compiler is wrong here, the patch makes sure
    that prev_offset is always initialized, just to silence the warning.
    
    v2: fix a spelling error in the commit message.
    Signed-off-by: default avatarPeter Oskolkov <posk@google.com>
    Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    d0b2818e
verifier.c 210 KB