From d3fdb05328531608736cf68880b9f39da6f3b9cd Mon Sep 17 00:00:00 2001
From: wangxiaomeng <wangxiaomeng@kylinos.cn>
Date: Thu, 14 Mar 2024 17:19:12 +0800
Subject: [PATCH] Fix build warning

---
 app/spdk_top/spdk_top.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/app/spdk_top/spdk_top.c b/app/spdk_top/spdk_top.c
index 3c0a889..d72c26f 100644
--- a/app/spdk_top/spdk_top.c
+++ b/app/spdk_top/spdk_top.c
@@ -674,7 +674,7 @@ print_max_len(WINDOW *win, int row, uint16_t col, uint16_t max_len, enum str_ali
 		snprintf(&tmp_str[max_str - DOTS_STR_LEN - 2], DOTS_STR_LEN, "%s", dots);
 	}
 
-	mvwprintw(win, row, col, tmp_str);
+	mvwprintw(win, row, col, "%s", tmp_str);
 
 	refresh();
 	wrefresh(win);
@@ -1937,19 +1937,19 @@ display_thread(struct rpc_thread_info *thread_info)
 
 	print_left(thread_win, 3, THREAD_WIN_FIRST_COL, THREAD_WIN_WIDTH,
 		   "Core:                Idle [us]:            Busy [us]:", COLOR_PAIR(5));
-	mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 6, "%" PRIu64,
+	mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 6, "%d",
 		  thread_info->core_num);
 
 	if (g_interval_data) {
 		get_time_str(g_thread_history[thread_info->id].idle, idle_time);
-		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 32, idle_time);
+		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 32, "%s", idle_time);
 		get_time_str(g_thread_history[thread_info->id].busy, busy_time);
-		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 54, busy_time);
+		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 54, "%s", busy_time);
 	} else {
 		get_time_str(thread_info->idle, idle_time);
-		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 32, idle_time);
+		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 32, "%s", idle_time);
 		get_time_str(thread_info->busy, busy_time);
-		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 54, busy_time);
+		mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 54, "%s", busy_time);
 	}
 
 	print_left(thread_win, 4, THREAD_WIN_FIRST_COL, THREAD_WIN_WIDTH,
@@ -1979,7 +1979,7 @@ display_thread(struct rpc_thread_info *thread_info)
 				mvwprintw(thread_win, current_row, THREAD_WIN_FIRST_COL, "%s", poller->name);
 				mvwprintw(thread_win, current_row, THREAD_WIN_FIRST_COL + 33, "Active");
 				snprintf(run_count, MAX_POLLER_COUNT_STR_LEN, "%" PRIu64, poller->run_count);
-				mvwprintw(thread_win, current_row, THREAD_WIN_FIRST_COL + 41, run_count);
+				mvwprintw(thread_win, current_row, THREAD_WIN_FIRST_COL + 41, "%s", run_count);
 				current_row++;
 			}
 			pollers = &thread->timed_pollers;
@@ -2108,20 +2108,20 @@ show_core(uint8_t current_page)
 		get_time_str(core_info[core_number]->idle, idle_time);
 		get_time_str(core_info[core_number]->busy, busy_time);
 	}
-	mvwprintw(core_win, 3, CORE_WIN_FIRST_COL + 20, idle_time);
+	mvwprintw(core_win, 3, CORE_WIN_FIRST_COL + 20, "%s", idle_time);
 
 	print_left(core_win, 5, 1, CORE_WIN_WIDTH, "Poller count:          Busy time:", COLOR_PAIR(5));
 	mvwprintw(core_win, 5, CORE_WIN_FIRST_COL, "%" PRIu64,
 		  g_cores_history[core_number].pollers_count);
 
-	mvwprintw(core_win, 5, CORE_WIN_FIRST_COL + 20, busy_time);
+	mvwprintw(core_win, 5, CORE_WIN_FIRST_COL + 20, "%s", busy_time);
 
 	mvwhline(core_win, 4, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
 	mvwhline(core_win, 6, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
 	print_left(core_win, 7, 1, CORE_WIN_WIDTH, "Threads on this core", COLOR_PAIR(5));
 
 	for (j = 0; j < core_info[core_number]->threads.threads_count; j++) {
-		mvwprintw(core_win, j + 8, 1, core_info[core_number]->threads.thread[j].name);
+		mvwprintw(core_win, j + 8, 1, "%s", core_info[core_number]->threads.thread[j].name);
 	}
 
 	refresh();
@@ -2132,7 +2132,7 @@ show_core(uint8_t current_page)
 	while (!stop_loop) {
 		for (j = 0; j < core_info[core_number]->threads.threads_count; j++) {
 			if (j != current_threads_row) {
-				mvwprintw(core_win, j + 8, 1, core_info[core_number]->threads.thread[j].name);
+				mvwprintw(core_win, j + 8, 1, "%s", core_info[core_number]->threads.thread[j].name);
 			} else {
 				print_left(core_win, j + 8, 1, CORE_WIN_WIDTH - 2,
 					   core_info[core_number]->threads.thread[j].name, COLOR_PAIR(2));
@@ -2204,9 +2204,9 @@ show_poller(uint8_t current_page)
 	mvwaddch(poller_win, 2, POLLER_WIN_WIDTH, ACS_RTEE);
 
 	print_left(poller_win, 3, 2, POLLER_WIN_WIDTH, "Type:                  On thread:", COLOR_PAIR(5));
-	mvwprintw(poller_win, 3, POLLER_WIN_FIRST_COL,
+	mvwprintw(poller_win, 3, POLLER_WIN_FIRST_COL, "%s",
 		  poller_type_str[pollers[poller_number]->type]);
-	mvwprintw(poller_win, 3, POLLER_WIN_FIRST_COL + 23, pollers[poller_number]->thread_name);
+	mvwprintw(poller_win, 3, POLLER_WIN_FIRST_COL + 23, "%s", pollers[poller_number]->thread_name);
 
 	print_left(poller_win, 4, 2, POLLER_WIN_WIDTH, "Run count:", COLOR_PAIR(5));
 
@@ -2221,7 +2221,7 @@ show_poller(uint8_t current_page)
 	if (pollers[poller_number]->period_ticks != 0) {
 		print_left(poller_win, 4, 28, POLLER_WIN_WIDTH, "Period:", COLOR_PAIR(5));
 		get_time_str(g_pollers_history[poller_number].period_ticks, poller_period);
-		mvwprintw(poller_win, 4, POLLER_WIN_FIRST_COL + 23, poller_period);
+		mvwprintw(poller_win, 4, POLLER_WIN_FIRST_COL + 23, "%s", poller_period);
 	}
 	mvwhline(poller_win, 5, 1, ACS_HLINE, POLLER_WIN_WIDTH - 2);
 	print_in_middle(poller_win, 6, 1, POLLER_WIN_WIDTH - 7, "Status:", COLOR_PAIR(5));
@@ -2374,13 +2374,13 @@ show_stats(void)
 			time_last = time_now.tv_sec;
 			rc = get_data();
 			if (rc) {
-				mvprintw(g_max_row - 1, g_max_col - strlen(refresh_error) - 2, refresh_error);
+				mvprintw(g_max_row - 1, g_max_col - strlen(refresh_error) - 2, "%s", refresh_error);
 			}
 
 			max_pages = refresh_tab(active_tab, current_page);
 
 			snprintf(current_page_str, CURRENT_PAGE_STR_LEN - 1, "Page: %d/%d", current_page + 1, max_pages);
-			mvprintw(g_max_row - 1, 1, current_page_str);
+			mvprintw(g_max_row - 1, 1, "%s", current_page_str);
 
 			free_data();
 
-- 
2.33.0

