[dpdk-dev] [DPDK] drivers/net: fix dereference after null check coverity
Stephen Hemminger
stephen at networkplumber.org
Mon Jul 15 06:06:14 CEST 2019
On Sat, 13 Jul 2019 00:39:47 +0800
Xiao Zhang <xiao.zhang at intel.com> wrote:
> This patch tries to fix the coverity issues of dereference after null
> check.
>
> Coverity issue: 343452
> Coverity issue: 343447
> Coverity issue: 343422
> Coverity issue: 343416
> Coverity issue: 343407
> Coverity issue: 343403
> Coverity issue: 13245
>
> Signed-off-by: Xiao Zhang <xiao.zhang at intel.com>
I think this should be fixed deeper in the vector code.
Example for ixgbe.
static inline uint16_t
reassemble_packets(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_bufs,
uint16_t nb_bufs, uint8_t *split_flags)
{
struct rte_mbuf *pkts[nb_bufs]; /*finished pkts*/
struct rte_mbuf *start = rxq->pkt_first_seg;
So start is rxq->pkt_first_seg.
But caller has already checked for NULL here.
It has iterated across the first packets but not updated rxq->first_seg.
if (rxq->pkt_first_seg == NULL) {
/* find the first split flag, and only reassemble then*/
while (i < nb_bufs && !split_flags[i])
i++;
if (i == nb_bufs)
return nb_bufs;
}
return i + reassemble_packets(rxq, &rx_pkts[i], nb_bufs - i,
More information about the dev
mailing list