From: "Liang, Cunming" <cunming.liang@intel.com>
To: "John W. Linville" <linville@tuxdriver.com>,
Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, John Linville <linville@redhat.com>
Subject: Re: [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by klocwork
Date: Wed, 25 Feb 2015 00:57:23 +0000 [thread overview]
Message-ID: <D0158A423229094DA7ABF71CF2FA0DA3118DE679@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20150220183854.GA4179@tuxdriver.com>
> -----Original Message-----
> From: John W. Linville [mailto:linville@tuxdriver.com]
> Sent: Saturday, February 21, 2015 2:39 AM
> To: Thomas Monjalon
> Cc: Liang, Cunming; dev@dpdk.org; John Linville
> Subject: Re: [dpdk-dev] [PATCH v1] afpacket: fix critical issue reported by
> klocwork
>
> On Fri, Feb 20, 2015 at 11:19:59AM +0100, Thomas Monjalon wrote:
> > Hi Cunming,
> >
> > You would have more chance to have a review by CC'ing John.
> > I checked your patch and have a comment below.
> >
> > 2015-02-12 17:08, Cunming Liang:
> > > Klocwork report 'req' might be used uninitialized.
> > > In some cases it can 'goto error' when '*internals' not been set.
> > > The result is unexpected checking the value of '*internals'.
> > >
> > > Signed-off-by: Cunming Liang <cunming.liang@intel.com>
> > > ---
> > > lib/librte_pmd_af_packet/rte_eth_af_packet.c | 4 +++-
> > > 1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> > > index 1ffe1cd..185607d 100644
> > > --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> > > +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> > > @@ -439,13 +439,15 @@ rte_pmd_init_internals(const char *name,
> > > size_t ifnamelen;
> > > unsigned k_idx;
> > > struct sockaddr_ll sockaddr;
> > > - struct tpacket_req *req;
> > > + struct tpacket_req *req = NULL;
> >
> > If *internals is set to NULL, there should be no case where req used
> > and undefined.
[LCM] Agree, so that's why I add '*internals = NULL' below as well.
>
> I agree -- it looks to me like req is protected by checking for
> *internals == NULL. I don't think this patch is necessary.
[LCM] The major piece of the patch is add setting for '*internals=NULL;'.
>
> > > struct pkt_rx_queue *rx_queue;
> > > struct pkt_tx_queue *tx_queue;
> > > int rc, qsockfd, tpver, discard;
> > > unsigned int i, q, rdsize;
> > > int fanout_arg __rte_unused, bypass __rte_unused;
> > >
> > > + *internals = NULL;
> > > +
> > > for (k_idx = 0; k_idx < kvlist->count; k_idx++) {
> > > pair = &kvlist->pairs[k_idx];
> > > if (strstr(pair->key, ETH_AF_PACKET_IFACE_ARG) != NULL)
> > >
> >
> >
> >
> >
>
> --
> John W. Linville Someday the world will need a hero, and you
> linville@tuxdriver.com might be all we have. Be ready.
next prev parent reply other threads:[~2015-02-25 0:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 9:08 Cunming Liang
2015-02-20 10:19 ` Thomas Monjalon
2015-02-20 18:38 ` John W. Linville
2015-02-25 0:57 ` Liang, Cunming [this message]
2015-02-25 8:45 ` Thomas Monjalon
2015-02-25 9:52 ` Liang, Cunming
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=D0158A423229094DA7ABF71CF2FA0DA3118DE679@shsmsx102.ccr.corp.intel.com \
--to=cunming.liang@intel.com \
--cc=dev@dpdk.org \
--cc=linville@redhat.com \
--cc=linville@tuxdriver.com \
--cc=thomas.monjalon@6wind.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).