From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, "Van Haaren, Harry" <harry.van.haaren@intel.com>,
"Mcnamara, John" <john.mcnamara@intel.com>
Subject: Re: [PATCH] xstats: fix behavior when a null array is provided
Date: Wed, 06 Apr 2016 12:13:38 +0200 [thread overview]
Message-ID: <3160973.YKeoJRatud@xps13> (raw)
In-Reply-To: <E923DB57A917B54B9182A2E928D00FA6128A3BE1@IRSMSX102.ger.corp.intel.com>
2016-04-05 11:06, Van Haaren, Harry:
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz
> > Subject: [dpdk-dev] [PATCH] xstats: fix behavior when a null array is provided
> >
> > Coverity reports an issue in ethdev:
> >
> > *** CID 124562: Null pointer dereferences (FORWARD_NULL)
> > /lib/librte_ether/rte_ethdev.c: 1518 in rte_eth_xstats_get()
> > 1512
> > 1513 /* global stats */
> > 1514 for (i = 0; i < RTE_NB_STATS; i++) {
> > 1515 stats_ptr = RTE_PTR_ADD(ð_stats,
> > 1516
> > rte_stats_strings[i].offset);
> > 1517 val = *stats_ptr;
> > >>> CID 124562: Null pointer dereferences (FORWARD_NULL)
> > >>> Dereferencing null pointer "xstats".
> > 1518 snprintf(xstats[count].name,
> > sizeof(xstats[count].name),
> > 1519 "%s", rte_stats_strings[i].name);
> > 1520 xstats[count++].value = val;
> > 1521 }
> > 1522
> > 1523 /* per-rxq stats */
> >
> > If a user calls rte_eth_xstats_get(portid, NULL, n) with n != 0,
> > it may result in a crash. Although the API documentation says that
> > n is the size of the table and xstats can be NULL if n == 0, we
> > can add an additional check here to make Coverity happy.
> >
> > In that case, the return value is the same than when n == 0 is
> > passed, it returns the number of statistics.
> >
> > Fixes: ce757f5c9a ("ethdev: new method to retrieve extended statistics")
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
>
> I'm unsure on how verbose commit messages are ideal,
> but there's certainly enough description here :)
>
> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Applied, thanks
prev parent reply other threads:[~2016-04-06 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 19:28 New Defects reported by Coverity Scan for DPDK Data Plane Development Kit Mcnamara, John
2016-04-04 15:45 ` [PATCH] xstats: fix behavior when a null array is provided Olivier Matz
2016-04-05 11:06 ` Van Haaren, Harry
2016-04-06 10:13 ` 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=3160973.YKeoJRatud@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=harry.van.haaren@intel.com \
--cc=john.mcnamara@intel.com \
--cc=olivier.matz@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 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.