mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: avoid bound check in freebsd binuptime
Fixes #76062 Change-Id: I683c1232aaeac12b0b3688472bb277adb95ad542 Reviewed-on: https://go-review.googlesource.com/c/go/+/715180 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
This commit is contained in:
parent
916e682d51
commit
dec2b4c83d
1 changed files with 3 additions and 0 deletions
|
|
@ -54,6 +54,9 @@ func binuptime(abs bool) (bt bintime) {
|
|||
}
|
||||
|
||||
curr := atomic.Load(&timekeepSharedPage.current) // atomic_load_acq_32
|
||||
if curr >= uint32(len(timehands)) {
|
||||
return zeroBintime
|
||||
}
|
||||
th := &timehands[curr]
|
||||
gen := atomic.Load(&th.gen) // atomic_load_acq_32
|
||||
bt = th.offset
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue