test/bpf: skip dump if conversion fails

If conversion of cBPF to eBPF fails (in rte_bpf_convert)
then the test should not try and print the result.

Coverity issue: 373661
Fixes: 2eccf6afbe ("bpf: add function to convert classic BPF to DPDK BPF")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
Stephen Hemminger 2022-02-10 15:09:05 -08:00 committed by Thomas Monjalon
parent 442878db2e
commit 78e7b29ff1

View File

@ -3273,8 +3273,10 @@ test_bpf_dump(struct bpf_program *cbf, const struct rte_bpf_prm *prm)
printf("cBPF program (%u insns)\n", cbf->bf_len);
bpf_dump(cbf, 1);
printf("\neBPF program (%u insns)\n", prm->nb_ins);
rte_bpf_dump(stdout, prm->ins, prm->nb_ins);
if (prm != NULL) {
printf("\neBPF program (%u insns)\n", prm->nb_ins);
rte_bpf_dump(stdout, prm->ins, prm->nb_ins);
}
}
static int