aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/hyp/nvhe/stacktrace.c
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2022-07-27 15:29:05 +0100
committerMarc Zyngier <maz@kernel.org>2022-07-27 18:18:38 +0100
commit62ae21627aa96f6ef361981dd181c74dc7aa314c (patch)
treec087793184ed00acbd5c2693598b2baecf441635 /arch/arm64/kvm/hyp/nvhe/stacktrace.c
parentKVM: arm64: Move nVHE-only helpers into kvm/stacktrace.c (diff)
downloadlinux-dev-62ae21627aa96f6ef361981dd181c74dc7aa314c.tar.xz
linux-dev-62ae21627aa96f6ef361981dd181c74dc7aa314c.zip
KVM: arm64: Don't open code ARRAY_SIZE()
Use ARRAY_SIZE() instead of an open-coded version. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Kalesh Singh <kaleshsingh@google.com> Tested-by: Kalesh Singh <kaleshsingh@google.com> Link: https://lore.kernel.org/r/20220727142906.1856759-6-maz@kernel.org
Diffstat (limited to 'arch/arm64/kvm/hyp/nvhe/stacktrace.c')
-rw-r--r--arch/arm64/kvm/hyp/nvhe/stacktrace.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/stacktrace.c b/arch/arm64/kvm/hyp/nvhe/stacktrace.c
index acbe272ecb32..58f645ad66bc 100644
--- a/arch/arm64/kvm/hyp/nvhe/stacktrace.c
+++ b/arch/arm64/kvm/hyp/nvhe/stacktrace.c
@@ -103,14 +103,13 @@ static void notrace unwind(struct unwind_state *state,
static bool pkvm_save_backtrace_entry(void *arg, unsigned long where)
{
unsigned long *stacktrace = this_cpu_ptr(pkvm_stacktrace);
- int size = NVHE_STACKTRACE_SIZE / sizeof(long);
int *idx = (int *)arg;
/*
* Need 2 free slots: 1 for current entry and 1 for the
* delimiter.
*/
- if (*idx > size - 2)
+ if (*idx > ARRAY_SIZE(pkvm_stacktrace) - 2)
return false;
stacktrace[*idx] = where;