net/ionic: fix up minor coverity issues
cover net/ionic: fix up minor coverity issues
These patches will make no functional difference, but should eliminate four coverity issues.
Alternatively, we could just mark them as False Positive or Ignored in coverity.
Andrew Boyer (2):
net/ionic: fix up minor coverity issue in queue allocation net/ionic: fix up minor coverity issue in packet transmit
drivers/net/ionic/ionic_lif.c | 4 ++-- drivers/net/ionic/ionic_rxtx_sg.c | 2 +- drivers/net/ionic/ionic_rxtx_simple.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 net/ionic: fix up minor coverity issue in queue allocation
(uint16_t * uint16_t) promoted to uint64_t has a sign extension problem reported by Coverity. Cast one arg to uint64_t first to eliminate the sign extension.
Coverity issue: 381617
Coverity issue: 381618
--- drivers/net/ionic/ionic_lif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_lif.c +2 -2
@@ -610,8 +610,8 @@ ionic_qcq_alloc(struct ionic_lif *lif,/* Most queue types will store 1 ptr per descriptor */ new->q.info =rte_calloc_socket ("ionic" , - num_descs * num_segs,sizeof (void *), - page_size, socket_id); + (uint64_t )num_descs * num_segs, +sizeof (void *), page_size, socket_id);if (!new->q.info) {IONIC_PRINT (ERR ,"Cannot allocate queue info" ); err = -ENOMEM ;
Signature · 1 line
2.17.1
PATCH 2/2 net/ionic: fix up minor coverity issue in packet transmit
In reply to Andrew BoyerIf tx_pkts is NULL, nb_pkts must be 0. Coverity doesn't know this so it thinks this is a forward-NULL violation. Make things more clear by checking for nb_pkts instead.
Coverity issue: 381614
Coverity issue: 381619
--- drivers/net/ionic/ionic_rxtx_sg.c | 2 +- drivers/net/ionic/ionic_rxtx_simple.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ionic/ionic_rxtx_sg.c +1 -1
@@ -175,7 +175,7 @@ ionic_xmit_pkts_sg(void *tx_queue, struct rte_mbuf **tx_pkts,rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (IONIC_INFO_PTR (q, q->head_idx)); -if (tx_pkts) { +if (nb_pkts) {rte_mbuf_prefetch_part1 (tx_pkts[0 ]);rte_mbuf_prefetch_part2 (tx_pkts[0 ]); }
drivers/net/ionic/ionic_rxtx_simple.c +1 -1
@@ -148,7 +148,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,rte_prefetch0 (&desc_base[q->head_idx]);rte_prefetch0 (&q->info[q->head_idx]); -if (tx_pkts) { +if (nb_pkts) {rte_mbuf_prefetch_part1 (tx_pkts[0 ]);rte_mbuf_prefetch_part2 (tx_pkts[0 ]); }
Signature · 1 line
2.17.1
Andrew Rybchenko
AppliedQuoted 8 lines · Andrew Boyer
These patches will make no functional difference, but should eliminate four coverity issues.
Alternatively, we could just mark them as False Positive or Ignored in coverity.
Signed-off-by Andrew Boyer <[email protected]>
Quoted 9 lines
Andrew Boyer (2):
net/ionic: fix up minor coverity issue in queue allocation net/ionic: fix up minor coverity issue in packet transmitdrivers/net/ionic/ionic_lif.c | 4 ++-- drivers/net/ionic/ionic_rxtx_sg.c | 2 +- drivers/net/ionic/ionic_rxtx_simple.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
Applied to dpdk-next-net/main, thanks.