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

Calvin Cheung calvin.cheung at oracle.com
Wed Apr 3 10:42:11 PDT 2013


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/bf77814b/attachment.html 


More information about the hotspot-runtime-dev mailing list