DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Xiao Zhang <xiao.zhang@intel.com>
Cc: dev@dpdk.org, qi.z.zhang@intel.com, xiao.w.wang@intel.com,
	beilei.xing@intel.com, wenzhuo.lu@intel.com,
	qiming.yang@intel.com, konstantin.ananyev@intel.com,
	jingjing.wu@intel.com
Subject: Re: [dpdk-dev] [DPDK] drivers/net: fix dereference after null check coverity
Date: Sun, 14 Jul 2019 21:06:14 -0700	[thread overview]
Message-ID: <20190714210614.3da438a5@hermes.lan> (raw)
In-Reply-To: <1562949587-8308-1-git-send-email-xiao.zhang@intel.com>

On Sat, 13 Jul 2019 00:39:47 +0800
Xiao Zhang <xiao.zhang@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@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,

  parent reply	other threads:[~2019-07-15  4:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 16:39 Xiao Zhang
2019-07-15  2:36 ` Yang, Qiming
2019-07-15  2:45   ` Zhang, Xiao
2019-07-15  4:06 ` Stephen Hemminger [this message]
2019-07-15  7:38   ` Zhang, Xiao

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=20190714210614.3da438a5@hermes.lan \
    --to=stephen@networkplumber.org \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiao.w.wang@intel.com \
    --cc=xiao.zhang@intel.com \
    /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 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).