X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fevent%2Fopdl%2Fopdl_evdev_xstats.c;h=27b3d88023114bbbcdef27223532e05e0cfabf8f;hb=a89f6433aa5cb33fc40ab30b92a911f547f21bcb;hp=94dfeee3c9e75d0d02039d32f5cfb1915a6f953e;hpb=3c7f3dcfb09944b28bca9effa6d92f392023c8e7;p=dpdk.git diff --git a/drivers/event/opdl/opdl_evdev_xstats.c b/drivers/event/opdl/opdl_evdev_xstats.c index 94dfeee3c9..27b3d88023 100644 --- a/drivers/event/opdl/opdl_evdev_xstats.c +++ b/drivers/event/opdl/opdl_evdev_xstats.c @@ -1,6 +1,5 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2017 Intel Corporation */ #include "opdl_evdev.h" @@ -33,10 +32,9 @@ opdl_xstats_init(struct rte_eventdev *dev) uint32_t index = (i * max_num_port_xstat) + j; /* Name */ - sprintf(device->port_xstat[index].stat.name, - "port_%02u_%s", - i, - port_xstat_str[j]); + snprintf(device->port_xstat[index].stat.name, + sizeof(device->port_xstat[index].stat.name), + "port_%02u_%s", i, port_xstat_str[j]); /* ID */ device->port_xstat[index].id = index; @@ -86,7 +84,8 @@ opdl_xstats_get_names(const struct rte_eventdev *dev, uint32_t port_idx = queue_port_id * max_num_port_xstat; - for (uint32_t j = 0; j < max_num_port_xstat; j++) { + uint32_t j; + for (j = 0; j < max_num_port_xstat; j++) { strcpy(xstats_names[j].name, device->port_xstat[j + port_idx].stat.name); @@ -121,7 +120,8 @@ opdl_xstats_get(const struct rte_eventdev *dev, uint32_t p_start = queue_port_id * max_num_port_xstat; uint32_t p_finish = p_start + max_num_port_xstat; - for (uint32_t i = 0; i < n; i++) { + uint32_t i; + for (i = 0; i < n; i++) { if (ids[i] < p_start || ids[i] >= p_finish) return -EINVAL; @@ -142,7 +142,8 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev, uint32_t max_index = device->max_port_nb * max_num_port_xstat; - for (uint32_t i = 0; i < max_index; i++) { + uint32_t i; + for (i = 0; i < max_index; i++) { if (strncmp(name, device->port_xstat[i].stat.name,