rcu: change format specifier in fprintf

Message ID 20190603204645.24401-1-honnappa.nagarahalli@arm.com
State New
Headers show
Series
  • rcu: change format specifier in fprintf
Related show

Commit Message

Honnappa Nagarahalli June 3, 2019, 8:46 p.m.
Use %u to fix argument type mismatch in fprintf.

Coverity issue: 340074
Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism")

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>


---
This patch is dependent on: http://patchwork.dpdk.org/patch/53455

 lib/librte_rcu/rte_rcu_qsbr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.17.1

Comments

Thomas Monjalon June 5, 2019, 12:18 p.m. | #1
03/06/2019 22:46, Honnappa Nagarahalli:
> Use %u to fix argument type mismatch in fprintf.

> 

> Coverity issue: 340074

> Fixes: 64994b56cfd7 ("rcu: add RCU library supporting QSBR mechanism")

> 

> Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>


Applied, thanks

Patch

diff --git a/lib/librte_rcu/rte_rcu_qsbr.c b/lib/librte_rcu/rte_rcu_qsbr.c
index b4ed01045..de2546464 100644
--- a/lib/librte_rcu/rte_rcu_qsbr.c
+++ b/lib/librte_rcu/rte_rcu_qsbr.c
@@ -234,7 +234,7 @@  rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
 		id = i << __RTE_QSBR_THRID_INDEX_SHIFT;
 		while (bmap) {
 			t = __builtin_ctzl(bmap);
-			fprintf(f, "%d ", id + t);
+			fprintf(f, "%u ", id + t);
 
 			bmap &= ~(1UL << t);
 		}
@@ -252,7 +252,7 @@  rte_rcu_qsbr_dump(FILE *f, struct rte_rcu_qsbr *v)
 		id = i << __RTE_QSBR_THRID_INDEX_SHIFT;
 		while (bmap) {
 			t = __builtin_ctzl(bmap);
-			fprintf(f, "thread ID = %d, count = %"PRIu64", lock count = %u\n",
+			fprintf(f, "thread ID = %u, count = %"PRIu64", lock count = %u\n",
 				id + t,
 				__atomic_load_n(
 					&v->qsbr_cnt[id + t].cnt,