Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6538429

Make HotSpot pscan clean

XMLWordPrintable

    • b03
    • generic
    • generic
    • Verified

        Subject: pscan warning fixlets
        Date: Wed, 21 Mar 2007 15:48:22 +0100
        From: Dalibor Topic <###@###.###>
        To: ###@###.###

        Inspired by cos's blog[0] from a while ago, I ran pscan[1] on the
        hotspot code base to scan for simple formatting issues, and produced the
        attached patch to introduce "%s" where it seemed appropriate.

        I tried to convince the bug tracker to let me file this as an RFE for
        making hotspot pscan clean, but I failed to find an openjdk category,
        and the bug tracker told me that generic platforms are not supported, so
        I'm posting this without a bug number.

        After applying the patch, there is one remaining warning from pscan
        about use of 'warn', but it's just the poor pscan tool getting confused
        about assembler_sparc.cpp having a method called 'warn'. It may make
        sense to rename it to, say, warning, if being 'pscan-clean' is of interest.

        cheers,
        dalibor topic

        [0] http://weblogs.java.net/blog/cos/archive/2006/10/static_analyzer.html

        [1] http://lwn.net/2000/0713/a/PScan.php3 , packaged for most
        distributions, afaik. Running pscan on the hotspot code base is pretty easy:

        dalibor@kaffe:~/$ find hotspot/ -name "*.c" | xargs pscan
        hotspot/src/os/linux/launcher/java_md.c:676 SECURITY: snprintf call should have "%s" as argument 2
        hotspot/src/os/linux/launcher/java_md.c:680 SECURITY: snprintf call should have "%s" as argument 2
        hotspot/src/os/solaris/launcher/java_md.c:676 SECURITY: snprintf call should have "%s" as argument 2
        hotspot/src/os/solaris/launcher/java_md.c:680 SECURITY: snprintf call should have "%s" as argument 2
        hotspot/src/os/solaris/dtrace/generateJvmOffsetsMain.c:45 SECURITY: printf call should have "%s" as argument 0
        hotspot/src/os/solaris/dtrace/generateJvmOffsetsMain.c:59 SECURITY: printf call should have "%s" as argument 0

        dalibor@kaffe:~/$ find hotspot/ -name "*.cpp" | xargs pscan
        hotspot/src/cpu/sparc/vm/assembler_sparc.cpp:1893 SECURITY: warn call should have "%s" as argument 0
        hotspot/agent/src/share/native/jvmdi/sa.cpp:238 SECURITY: fprintf call should have "%s" as argument 1

        so it may be useful to add a makefile target for it.

              pbk Peter Kessler
              pbk Peter Kessler
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: