Skip to content

Commit

Permalink
runtime: fix build, divide by constant 0 is a compile-time error
Browse files Browse the repository at this point in the history
Change-Id: Iee319c9f5375c172fb599da77234c10ccb0fd314
Reviewed-on: https://go-review.googlesource.com/6020
Reviewed-by: Keith Randall <[email protected]>
  • Loading branch information
randall77 committed Feb 25, 2015
1 parent 972f364 commit 35a59f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/mem_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ func sysAlloc(n uintptr, stat *uint64) unsafe.Pointer {
}

func sysUnused(v unsafe.Pointer, n uintptr) {
if hugePageSize != 0 && (uintptr(v)%hugePageSize != 0 || n%hugePageSize != 0) {
var s uintptr = hugePageSize // division by constant 0 is a compile-time error :(
if s != 0 && (uintptr(v)%s != 0 || n%s != 0) {
// See issue 8832
// Linux kernel bug: https://bugzilla.kernel.org/show_bug.cgi?id=93111
// Mark the region as NOHUGEPAGE so the kernel's khugepaged
Expand Down

0 comments on commit 35a59f5

Please sign in to comment.