test/rcu: fix memory size integer truncate
authorHonnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Tue, 8 Oct 2019 21:12:17 +0000 (16:12 -0500)
committerDavid Marchand <david.marchand@redhat.com>
Mon, 21 Oct 2019 15:54:40 +0000 (17:54 +0200)
Variables used to store the return value of rte_rcu_qsbr_get_memsize
in variables of type 'int' or 'uint32_t'.
While the former variables are a problem, the latter have been aligned
for consistency.
The variables are of type 'size_t' now.

Fixes: b87089b0bb19 ("test/rcu: add API and functional tests")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
app/test/test_rcu_qsbr.c
app/test/test_rcu_qsbr_perf.c

index d1b9e46..2f71ec6 100644 (file)
@@ -52,7 +52,7 @@ static int
 alloc_rcu(void)
 {
        int i;
-       uint32_t sz;
+       size_t sz;
 
        sz = rte_rcu_qsbr_get_memsize(RTE_MAX_LCORE);
 
@@ -81,7 +81,7 @@ free_rcu(void)
 static int
 test_rcu_qsbr_get_memsize(void)
 {
-       uint32_t sz;
+       size_t sz;
 
        printf("\nTest rte_rcu_qsbr_thread_register()\n");
 
index cb2d177..280f181 100644 (file)
@@ -125,7 +125,7 @@ test_rcu_qsbr_writer_perf(void *arg)
 static int
 test_rcu_qsbr_perf(void)
 {
-       int sz;
+       size_t sz;
        unsigned int i, tmp_num_cores;
 
        writer_done = 0;
@@ -188,7 +188,7 @@ test_rcu_qsbr_perf(void)
 static int
 test_rcu_qsbr_rperf(void)
 {
-       int sz;
+       size_t sz;
        unsigned int i, tmp_num_cores;
 
        rte_atomic64_clear(&updates);
@@ -234,7 +234,7 @@ test_rcu_qsbr_rperf(void)
 static int
 test_rcu_qsbr_wperf(void)
 {
-       int sz;
+       size_t sz;
        unsigned int i;
 
        rte_atomic64_clear(&checks);
@@ -379,7 +379,7 @@ static int
 test_rcu_qsbr_sw_sv_1qs(void)
 {
        uint64_t token, begin, cycles;
-       int sz;
+       size_t sz;
        unsigned int i, j, tmp_num_cores;
        int32_t pos;
 
@@ -498,7 +498,8 @@ static int
 test_rcu_qsbr_sw_sv_1qs_non_blocking(void)
 {
        uint64_t token, begin, cycles;
-       int ret, sz;
+       int ret;
+       size_t sz;
        unsigned int i, j, tmp_num_cores;
        int32_t pos;