[commit: ghc] master: Revert "Check for integer overflow in osGetMBlocks" (29ee739)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 00:32:23 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/29ee739ec8937501171426ef845279ec307b18b8/ghc

>---------------------------------------------------------------

commit 29ee739ec8937501171426ef845279ec307b18b8
Author: Austin Seipp <aseipp at pobox.com>
Date:   Thu Aug 29 17:30:16 2013 -0500

    Revert "Check for integer overflow in osGetMBlocks"
    
    This reverts commit 48865521de6638240819b3979edbb3d33401dc8e.
    
    Signed-off-by: Austin Seipp <aseipp at pobox.com>


>---------------------------------------------------------------

29ee739ec8937501171426ef845279ec307b18b8
 rts/posix/OSMem.c |   13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index 000ad63..26aebc2 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -177,18 +177,7 @@ void *
 osGetMBlocks(nat n)
 {
   caddr_t ret;
-  W_ size;
-
-  // Compute size = MBLOCK_SIZE * (W_)n,
-  // while testing for integer overflow.
-  // We assume that W_ is at least as large a type as nat.
-  if ((W_)n > ((W_)-1) / MBLOCK_SIZE) {
-      // We tried to allocate, say, 4 GB or more on a 32-bit system.
-      errorBelch("out of memory (requested %d MBlocks)", n);
-      stg_exit(EXIT_FAILURE);
-  } else {
-      size = MBLOCK_SIZE * (W_)n;
-  }
+  W_ size = MBLOCK_SIZE * (W_)n;
 
   if (next_request == 0) {
       // use gen_map_mblocks the first time.





More information about the ghc-commits mailing list