[commit: ghc] master: coverity: Suppress some time-of-check-time-of-use reports (6d11a0e)

git at git.haskell.org git at git.haskell.org
Sun Apr 27 11:45:38 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6d11a0e1400e44e16e0ee7734279c67619442a1d/ghc

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

commit 6d11a0e1400e44e16e0ee7734279c67619442a1d
Author: Austin Seipp <austin at well-typed.com>
Date:   Sun Apr 27 04:19:24 2014 -0500

    coverity: Suppress some time-of-check-time-of-use reports
    
    CID 43178
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

6d11a0e1400e44e16e0ee7734279c67619442a1d
 rts/Linker.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/rts/Linker.c b/rts/Linker.c
index ab235e9..1b0d48f 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -2810,6 +2810,7 @@ loadObj( pathchar *path )
 
    /* Check that we haven't already loaded this object.
       Ignore requests to load multiple times */
+
    if (isAlreadyLoaded(path)) {
        IF_DEBUG(linker,
                 debugBelch("ignoring repeated load of %" PATH_FMT "\n", path));
@@ -2828,8 +2829,10 @@ loadObj( pathchar *path )
    /* On many architectures malloc'd memory isn't executable, so we need to use mmap. */
 
 #if defined(openbsd_HOST_OS)
+   /* coverity[toctou] */
    fd = open(path, O_RDONLY, S_IRUSR);
 #else
+   /* coverity[toctou] */
    fd = open(path, O_RDONLY);
 #endif
    if (fd == -1)
@@ -2841,6 +2844,7 @@ loadObj( pathchar *path )
 
 #else /* !USE_MMAP */
    /* load the image into memory */
+   /* coverity[toctou] */
    f = pathopen(path, WSTR("rb"));
    if (!f)
        barf("loadObj: can't read `%" PATH_FMT "'", path);



More information about the ghc-commits mailing list