test/latency: fix loop boundary
authorDavid Marchand <david.marchand@redhat.com>
Sat, 2 Oct 2021 16:24:31 +0000 (18:24 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Tue, 5 Oct 2021 15:29:42 +0000 (17:29 +0200)
Caught running ASAN.

lat_stats_strings[] is an array containing NUM_STATS strings.

Fixes: 1e3676a06e4c ("test/latency: add unit tests for latencystats library")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
app/test/test_latencystats.c

index 4273399..724acbc 100644 (file)
@@ -80,7 +80,7 @@ static int test_latencystats_get_names(void)
        /* Success Test: Valid names and size */
        size = NUM_STATS;
        ret = rte_latencystats_get_names(names, size);
-       for (i = 0; i <= NUM_STATS; i++) {
+       for (i = 0; i < NUM_STATS; i++) {
                if (strcmp(lat_stats_strings[i].name, names[i].name) == 0)
                        printf(" %s\n", names[i].name);
                else