From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL
Date: Thu, 10 Feb 2022 15:09:05 -0800 [thread overview]
Message-ID: <20220210230906.833163-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20220210230906.833163-1-stephen@networkplumber.org>
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")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_bpf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c
index d1e10adab545..805cce640667 100644
--- a/app/test/test_bpf.c
+++ b/app/test/test_bpf.c
@@ -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
--
2.34.1
next prev parent reply other threads:[~2022-02-10 23:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 23:09 [PATCH 0/3] small fixes suggested by Coverity scan Stephen Hemminger
2022-02-10 23:09 ` [PATCH 1/3] pcapng: handle rte_ethlink_get failing Stephen Hemminger
2022-02-10 23:09 ` Stephen Hemminger [this message]
2022-02-11 11:02 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Ananyev, Konstantin
2022-02-10 23:09 ` [PATCH 3/3] app/dumpcap: check for failure to set promiscious Stephen Hemminger
2022-03-08 8:20 ` [PATCH 0/3] small fixes suggested by Coverity scan Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220210230906.833163-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.