All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: "Liang, Cunming" <cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dev-VfR2kkLFssw@public.gmane.org,
	John Linville <linville-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v1] afpacket: fix critical issue reported by klocwork
Date: Wed, 25 Feb 2015 10:56:22 +0100	[thread overview]
Message-ID: <1918339.MLD1NqnMmG@xps13> (raw)
In-Reply-To: <D0158A423229094DA7ABF71CF2FA0DA3118DED48-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>

2015-02-25 09:52, Liang, Cunming:
> From: Thomas Monjalon [mailto:thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org]
> > 2015-02-25 00:57, Liang, Cunming:
> > > From: John W. Linville [mailto:linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org]
> > > > On Fri, Feb 20, 2015 at 11:19:59AM +0100, Thomas Monjalon wrote:
> > > > > 2015-02-12 17:08, Cunming Liang:
> > > > > > --- 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;'.
> > 
> > Yes understood, but it is already initialized to NULL before calling
> > rte_pmd_init_internals():
> > http://dpdk.org/browse/dpdk/tree/lib/librte_pmd_af_packet/rte_eth_af_packet
> > .c#n706
> [LCM] I see, it's complained by klocwork.
> So either adding 'internals=NULL' or adding some comments helps to avoid checking again on the next scanning.
> How do you think ?

No, we don't have to pollute the code for a tool.
You should check how to disable this false positive in your tool.

      parent reply	other threads:[~2015-02-25  9:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12  9:08 [PATCH v1] afpacket: fix critical issue reported by klocwork Cunming Liang
     [not found] ` <1423732089-6202-1-git-send-email-cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-02-20 10:19   ` Thomas Monjalon
2015-02-20 18:38     ` John W. Linville
     [not found]       ` <20150220183854.GA4179-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2015-02-25  0:57         ` Liang, Cunming
     [not found]           ` <D0158A423229094DA7ABF71CF2FA0DA3118DE679-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-25  8:45             ` Thomas Monjalon
2015-02-25  9:52               ` Liang, Cunming
     [not found]                 ` <D0158A423229094DA7ABF71CF2FA0DA3118DED48-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-02-25  9:56                   ` Thomas Monjalon [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=1918339.MLD1NqnMmG@xps13 \
    --to=thomas.monjalon-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=cunming.liang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    --cc=linville-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.