* [PATCH 0/3] small fixes suggested by Coverity scan
@ 2022-02-10 23:09 Stephen Hemminger
2022-02-10 23:09 ` [PATCH 1/3] pcapng: handle rte_ethlink_get failing Stephen Hemminger
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Stephen Hemminger @ 2022-02-10 23:09 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
Fix some simple bugs.
Stephen Hemminger (3):
pcapng: handle rte_ethlink_get failing
app/test_bpf: don't print eBPF program if NULL
app/dumpcap: check for failure to set promiscious
app/dumpcap/main.c | 9 +++++++--
app/test/test_bpf.c | 6 ++++--
lib/pcapng/rte_pcapng.c | 4 ++--
3 files changed, 13 insertions(+), 6 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] pcapng: handle rte_ethlink_get failing
2022-02-10 23:09 [PATCH 0/3] small fixes suggested by Coverity scan Stephen Hemminger
@ 2022-02-10 23:09 ` Stephen Hemminger
2022-02-10 23:09 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Stephen Hemminger
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2022-02-10 23:09 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
If rte_ethlink_get fails, the code can just not add speed
to the pcap file.
Coverity issue: 373664
Fixes: 8d23ce8f5ee9 ("pcapng: add new library for writing pcapng files")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/pcapng/rte_pcapng.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 03edabe73e96..9db058fe422b 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -177,8 +177,8 @@ pcapng_add_interface(rte_pcapng_t *self, uint16_t port)
"%s-%s", dev->bus->name, dev->name);
/* DPDK reports in units of Mbps */
- rte_eth_link_get(port, &link);
- if (link.link_status == RTE_ETH_LINK_UP)
+ if (rte_eth_link_get(port, &link) == 0 &&
+ link.link_status == RTE_ETH_LINK_UP)
speed = link.link_speed * PCAPNG_MBPS_SPEED;
if (rte_eth_macaddr_get(port, &macaddr) < 0)
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL
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
2022-02-11 11:02 ` 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
3 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2022-02-10 23:09 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] app/dumpcap: check for failure to set promiscious
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 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Stephen Hemminger
@ 2022-02-10 23:09 ` Stephen Hemminger
2022-03-08 8:20 ` [PATCH 0/3] small fixes suggested by Coverity scan Thomas Monjalon
3 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2022-02-10 23:09 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
If the rte_eth_promiscious_enable() fails, then log the error
and continue.
Coverity issue: 373662
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/dumpcap/main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index c5fe4403028a..21cb2810a48f 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -679,8 +679,13 @@ static void enable_pdump(struct rte_ring *r, struct rte_mempool *mp)
flags |= RTE_PDUMP_FLAG_PCAPNG;
TAILQ_FOREACH(intf, &interfaces, next) {
- if (promiscuous_mode)
- rte_eth_promiscuous_enable(intf->port);
+ if (promiscuous_mode) {
+ ret = rte_eth_promiscuous_enable(intf->port);
+ if (ret != 0)
+ fprintf(stderr,
+ "port %u set promicious enable faile: %d\n",
+ intf->port, ret);
+ }
ret = rte_pdump_enable_bpf(intf->port, RTE_PDUMP_ALL_QUEUES,
flags, snaplen,
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL
2022-02-10 23:09 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Stephen Hemminger
@ 2022-02-11 11:02 ` Ananyev, Konstantin
0 siblings, 0 replies; 6+ messages in thread
From: Ananyev, Konstantin @ 2022-02-11 11:02 UTC (permalink / raw)
To: Stephen Hemminger, dev
> 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
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] small fixes suggested by Coverity scan
2022-02-10 23:09 [PATCH 0/3] small fixes suggested by Coverity scan Stephen Hemminger
` (2 preceding siblings ...)
2022-02-10 23:09 ` [PATCH 3/3] app/dumpcap: check for failure to set promiscious Stephen Hemminger
@ 2022-03-08 8:20 ` Thomas Monjalon
3 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2022-03-08 8:20 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
11/02/2022 00:09, Stephen Hemminger:
> Fix some simple bugs.
>
> Stephen Hemminger (3):
> pcapng: handle rte_ethlink_get failing
> app/test_bpf: don't print eBPF program if NULL
> app/dumpcap: check for failure to set promiscious
Improved titles and applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-08 8:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 2/3] app/test_bpf: don't print eBPF program if NULL Stephen Hemminger
2022-02-11 11:02 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).