Commit Graph

10 Commits

Author SHA1 Message Date
Remy Horton
255d42d5b6 metrics: fix potential missing string termination
Fixes a potential memory overrun detected by Coverity.
This overrun cannot currently happen in practice because
rte_metrics_reg_names() explicitly forces the last name
character to be a NULL terminator.

This patches uses strlcpy instead of strncpy to copy name strings.

Coverity issue: 143434
Fixes: 349950ddb9 ("metrics: add information metrics library")
Fixes: 710cab6f67 ("metrics: fix out of bound access")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-04 17:33:08 +02:00
Bruce Richardson
6c9457c279 build: replace license text with SPDX tag
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Luca Boccassi <bluca@debian.org>
2018-01-30 21:58:59 +01:00
Bruce Richardson
5b9656b157 lib: build with meson
Add non-EAL libraries to DPDK build. The compat lib is a special case,
along with the previously-added EAL, but all other libs can be build using
the same set of commands, where the individual meson.build files only need
to specify their dependencies, source files, header files and ABI versions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
2018-01-30 17:49:16 +01:00
Bruce Richardson
369991d997 lib: use SPDX tag for Intel copyright files
Replace the BSD license header with the SPDX tag for files
with only an Intel copyright on them.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2018-01-04 22:41:39 +01:00
Olivier Matz
cbc12b0a96 mk: do not generate LDLIBS from directory dependencies
The list of libraries in LDLIBS was generated from the DEPDIRS-xyz
variable. This is valid when the subdirectory name match the library
name, but it's not always the case, especially for PMDs.

The patches removes this feature and explicitly adds the proper
libraries in LDLIBS.

Some DEPDIRS-xyz variables become useless, remove them.

Reported-by: Gage Eads <gage.eads@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Gage Eads <gage.eads@intel.com>
2017-10-24 02:14:57 +02:00
Olivier Matz
0e985314d5 metrics: fix compilation with -Og
The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the following
error:

  CC rte_metrics.o
  rte_metrics.c: In function
  ‘rte_metrics_reg_names’: rte_metrics.c:153:22: error: ‘entry’
                           may be used uninitialized in this function
                           [-Werror=maybe-uninitialized]
    entry->idx_next_set = 0;
    ~~~~~~~~~~~~~~~~~~~~^~~

This is a false positive, gcc is not able to see that we always go in
the loop at least once, initializing entry.

Fix the warning by initializing entry to NULL.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2017-10-06 02:49:50 +02:00
Remy Horton
fa43ac7729 metrics: fix name string termination
The public API (struct rte_metric_name) includes the NULL terminator
byte in RTE_METRICS_MAX_NAME_LENGTH but the library itself internally
excludes it. This makes it possible for an application to receive an
unterminated name string. Fix be enforcing the NULL termination of all
name strings to the length that the public API expects.

Fixes: 349950ddb9 ("metrics: add information metrics library")
Cc: stable@dpdk.org

Signed-off-by: Remy Horton <remy.horton@intel.com>
2017-07-20 00:06:07 +03:00
Remy Horton
710cab6f67 metrics: fix out of bound access
Fixes memory access errors detected by Coverity.
All cases are the maximum permissable value causing an
out-by-one overrun.

Coverity issue: 143433, 143434, 143460, 143464
Fixes: 349950ddb9 ("metrics: add information metrics library")

Signed-off-by: Remy Horton <remy.horton@intel.com>
2017-06-05 15:30:27 +02:00
Adrien Mazarguil
38accc1edf metrics: fix exported header
This commit addresses the following compilation errors:

 In file included from /tmp/check-includes.sh.21060.c:1:0:
 build/include/rte_metrics.h:91:2: error: unknown type name 'uint16_t'
 [...]

It also adds C++ awareness to rte_metrics.h.

Fixes: 349950ddb9 ("metrics: add information metrics library")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Remy Horton <remy.horton@intel.com>
2017-05-01 00:13:15 +02:00
Remy Horton
349950ddb9 metrics: add information metrics library
This patch adds a new information metrics library. This Metrics
library implements a mechanism by which producers can publish
numeric information for later querying by consumers. Metrics
themselves are statistics that are not generated by PMDs, and
hence are not reported via ethdev extended statistics.

Metric information is populated using a push model, where
producers update the values contained within the metric
library by calling an update function on the relevant metrics.
Consumers receive metric information by querying the central
metric data, which is held in shared memory.

Signed-off-by: Remy Horton <remy.horton@intel.com>
2017-04-05 17:58:51 +02:00