diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-02-13 02:14:26 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-02-13 02:14:26 +0000 |
commit | f7221229ddee0d92f5eac4f9167a69177fc8317a (patch) | |
tree | 3d731c1df41302d6ca5b95700ccea8c768eb4bc8 /sys/arch/armv7 | |
parent | a64504f0f7fc533b72d7c640e89baf18c62fab10 (diff) |
fix off-by-one in bounds test
found by "buffer overflow 'mvacc_cpu_freqs' 13 <= 13" smatch error
ok miod@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r-- | sys/arch/armv7/marvell/mvacc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/armv7/marvell/mvacc.c b/sys/arch/armv7/marvell/mvacc.c index 6926aaef728..d5791dfd9b3 100644 --- a/sys/arch/armv7/marvell/mvacc.c +++ b/sys/arch/armv7/marvell/mvacc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvacc.c,v 1.5 2022/07/11 10:44:08 jmatthew Exp $ */ +/* $OpenBSD: mvacc.c,v 1.6 2024/02/13 02:14:25 jsg Exp $ */ /* * Copyright (c) 2016 Patrick Wildt <patrick@blueri.se> * @@ -133,7 +133,7 @@ mvacc_get_frequency(void *cookie, uint32_t *cells) cpu = (sar >> SAR_CPU_DDR_FREQ_OPT) & SAR_CPU_DDR_FREQ_OPT_MASK; tclk = (sar >> SAR_TCLK_FREQ_OPT) & SAR_TCLK_FREQ_OPT_MASK; - if (cpu > nitems(mvacc_cpu_freqs)) { + if (cpu >= nitems(mvacc_cpu_freqs)) { printf("%s: invalid cpu frequency", sc->sc_dev.dv_xname); return 0; } |