From: "Zhang, Xiao" <xiao.zhang@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Zhang, Qi Z" <qi.z.zhang@intel.com>,
"Wang, Xiao W" <xiao.w.wang@intel.com>,
"Xing, Beilei" <beilei.xing@intel.com>,
"Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
"Yang, Qiming" <qiming.yang@intel.com>,
"Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
"Wu, Jingjing" <jingjing.wu@intel.com>
Subject: Re: [dpdk-dev] [DPDK] drivers/net: fix dereference after null check coverity
Date: Mon, 15 Jul 2019 07:38:39 +0000 [thread overview]
Message-ID: <AF0377F445CB2540BB46FF359C1C1BBE0116824D@SHSMSX105.ccr.corp.intel.com> (raw)
In-Reply-To: <20190714210614.3da438a5@hermes.lan>
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Monday, July 15, 2019 12:06 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>; Ananyev,
> Konstantin <konstantin.ananyev@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>
> Subject: Re: [dpdk-dev] [DPDK] drivers/net: fix dereference after null check
> coverity
>
> 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.
Yes, this seems to be a bug but not a coverity issue. I will fix it.
> 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,
prev parent reply other threads:[~2019-07-15 7:39 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
2019-07-15 7:38 ` Zhang, Xiao [this message]
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=AF0377F445CB2540BB46FF359C1C1BBE0116824D@SHSMSX105.ccr.corp.intel.com \
--to=xiao.zhang@intel.com \
--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=stephen@networkplumber.org \
--cc=wenzhuo.lu@intel.com \
--cc=xiao.w.wang@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).