]> git.droids-corp.org - dpdk.git/commitdiff
test/bpf: skip dump if conversion fails
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 10 Feb 2022 23:09:05 +0000 (15:09 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 8 Mar 2022 08:19:41 +0000 (09:19 +0100)
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: 2eccf6afbea9 ("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>
app/test/test_bpf.c

index d1e10adab545a5bc48436006c981d247fe5fa1fa..805cce640667ae904cedd605c5ed0e1b87bef38e 100644 (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