spdk_top: fix poller selection in pollers tab

Change 821d8e2 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: Krzysztof 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Krzysztof Karas 2021-07-29 12:31:53 +02:00 committed by Tomasz Zawadzki
parent 2db77dc9c7
commit 5a85159957

View File

@ -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;
}