• Wang Sheng-Hui's avatar
    samples, bpf: remove redundant ret assignment in bpf_load_program() · c0885f61
    Wang Sheng-Hui authored
    2 redundant ret assignments removed:
    
    * 'ret = 1' before the logic 'if (data_maps)', and if any errors jump to
      label 'done'. No 'ret = 1' needed before the error jump.
    
    * After the '/* load programs */' part, if everything goes well, then
      the BPF code will be loaded and 'ret' set to 0 by load_and_attach().
      If something goes wrong, 'ret' set to none-O, the redundant 'ret = 0'
      after the for clause will make the error skipped.
    
      For example, if some BPF code cannot provide supported program types
      in ELF SEC("unknown"), the for clause will not call load_and_attach()
      to load the BPF code. 1 should be returned to callees instead of 0.
    Signed-off-by: default avatarWang Sheng-Hui <shhuiw@foxmail.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    c0885f61
bpf_load.c 16.7 KB