It is better to have more descriptive name than 'j' for the associated local variable in sgx_reclaim_pages() as it does not represent just a trivial loop index like 'i' does. Thus, rename it as 'cnt'. Cc: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Cc: Shay Katz-zamir <shay.katz-zamir@xxxxxxxxx> Cc: Serge Ayoun <serge.ayoun@xxxxxxxxx> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx> --- arch/x86/kernel/cpu/sgx/reclaim.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/reclaim.c b/arch/x86/kernel/cpu/sgx/reclaim.c index 213406756443..cfda38a9b05c 100644 --- a/arch/x86/kernel/cpu/sgx/reclaim.c +++ b/arch/x86/kernel/cpu/sgx/reclaim.c @@ -403,12 +403,13 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page) void sgx_reclaim_pages(void) { struct sgx_epc_page *chunk[SGX_NR_TO_SCAN + 1]; - struct sgx_epc_page *epc_page; struct sgx_epc_section *section; - int i, j; + struct sgx_epc_page *epc_page; + int cnt = 0; + int i; spin_lock(&sgx_active_page_list_lock); - for (i = 0, j = 0; i < SGX_NR_TO_SCAN; i++) { + for (i = 0; i < SGX_NR_TO_SCAN; i++) { if (list_empty(&sgx_active_page_list)) break; @@ -417,7 +418,7 @@ void sgx_reclaim_pages(void) list_del_init(&epc_page->list); if (sgx_reclaimer_get(epc_page)) - chunk[j++] = epc_page; + chunk[cnt++] = epc_page; else /* The owner is freeing the page. No need to add the * page back to the list of reclaimable pages. @@ -426,7 +427,7 @@ void sgx_reclaim_pages(void) } spin_unlock(&sgx_active_page_list_lock); - for (i = 0; i < j; i++) { + for (i = 0; i < cnt; i++) { epc_page = chunk[i]; if (sgx_reclaimer_evict(epc_page)) continue; @@ -440,13 +441,13 @@ void sgx_reclaim_pages(void) chunk[i] = NULL; } - for (i = 0; i < j; i++) { + for (i = 0; i < cnt; i++) { epc_page = chunk[i]; if (epc_page) sgx_reclaimer_block(epc_page); } - for (i = 0; i < j; i++) { + for (i = 0; i < cnt; i++) { epc_page = chunk[i]; if (epc_page) { sgx_reclaimer_write(epc_page); -- 2.20.1