Commit 5a851599 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

spdk_top: fix poller selection in pollers tab



Change 821d8e26 introduced a bug in pollers tab - user
might select rows below last displayed poller and possibly
crash the application when invoking a pop-up details window
there. This patch aims to resolve the issue.

Change-Id: I9aa3a42e2327a27597a48b32dd8e9fa216e2b17e
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8978


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 2db77dc9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1413,7 +1413,7 @@ refresh_pollers_tab(uint8_t current_page)
	struct col_desc *col_desc = g_col_desc[POLLERS_TAB];
	uint64_t last_run_counter, last_busy_counter;
	uint64_t i, j;
	uint16_t col;
	uint16_t col, empty_col = 0;
	uint8_t max_pages, item_index;
	char run_count[MAX_POLLER_RUN_COUNT], period_ticks[MAX_PERIOD_STR_LEN],
	     status[MAX_POLLER_IND_STR_LEN];
@@ -1433,6 +1433,7 @@ refresh_pollers_tab(uint8_t current_page)
				mvwprintw(g_tabs[POLLERS_TAB], item_index + TABS_DATA_START_ROW, j, " ");
			}

			empty_col++;
			continue;
		}

@@ -1528,7 +1529,7 @@ refresh_pollers_tab(uint8_t current_page)
		}
	}

	g_max_selected_row = i - current_page * g_max_data_rows - 1;
	g_max_selected_row = i - current_page * g_max_data_rows - 1 - empty_col;

	return max_pages;
}