aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/chan.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/chan.c')
-rw-r--r--libgo/runtime/chan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/runtime/chan.c b/libgo/runtime/chan.c
index c8ee10e8c..d0a1612ad 100644
--- a/libgo/runtime/chan.c
+++ b/libgo/runtime/chan.c
@@ -3,6 +3,8 @@
// license that can be found in the LICENSE file.
#include "runtime.h"
+#include "arch.h"
+#include "malloc.h"
#include "go-type.h"
#define NOSELGEN 1
@@ -88,7 +90,7 @@ runtime_makechan_c(ChanType *t, int64 hint)
elem = t->__element_type;
- if(hint < 0 || (int32)hint != hint || (elem->__size > 0 && (uintptr)hint > ((uintptr)-1) / elem->__size))
+ if(hint < 0 || (int32)hint != hint || (elem->__size > 0 && (uintptr)hint > MaxMem / elem->__size))
runtime_panicstring("makechan: size out of range");
n = sizeof(*c);