XS RFR: 8006001: [parfait] Possible file leak in hotspot/src/os/linux/vm/perfMemory_linux.cpp

harold seigel harold.seigel at oracle.com
Wed Apr 3 11:18:29 PDT 2013


Hi Calvin,

Perhaps the *assert* inside of the 'if' statement can now be removed?

    @@ -915,10 +915,14 @@
      if (*sizep == 0) {
        size = sharedmem_filesize(fd, CHECK);
    *assert(size != 0, "unexpected size");*
      }

    + // make sure size > 0; in case *sizep is non-zero, the above "if"
    block
    + // won't be executed
    + assert(size > 0, "unexpected size <= 0");

Thanks, Harold

On 4/3/2013 1:42 PM, Calvin Cheung wrote:
> Fixing the following 2 warnings reported by the parfait tool:
>
> 1) fd leaks when ThreadShadow::has_pending_exception(((unresolved 
> type*)__the_thread__)) is true at line 897
>     (I couldn't reproduce this warning with parfait even with the 
> "--warning" option)
>
> Fix: instead of using THROW_MSG_0 which returns 0, use THROW_MSG_ with 
> return value of OS_ERR.
>        There's already an assert(fd != OS_ERR) after calling 
> open_sharedmem_file().
>
> 2) Possible uninitialised variable (CWE 457): Uninitialised variable 
> 'size' may be used as argument 2 when calling mmap at line 905 of 
> src/os/linux/vm/perfMemory_linux.cpp
>
> Fix: add an assert(size > 0) before calling ::mmap().
>
> webrev: http://http://cr.openjdk.java.net/~ccheung/8006001/ 
> <http://cr.openjdk.java.net/%7Eccheung/8006001/>
> bug: https://jbs.oracle.com/bugs/browse/JDK-8006001
>
> Tests:
>     JPRT
>     parfait
>
> thanks,
> Calvin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/attachments/20130403/9c8f232b/attachment-0001.html 


More information about the hotspot-runtime-dev mailing list