[pcp] pcp updates - coverity changes for pmcd and pmlogger

Ken McDonell kenj at internode.on.net
Fri Feb 3 18:20:05 CST 2012


No problems with the pmcd ones ... summary is here
http://www.users.on.net/~kenj/pcp/coverity-pmcd.html

For pmlogger, mostly OK, but I'd appreciate reviews for #219 and #220
(really the one basic issue) where I think the Coverity analysis is
wrong.  The summary is here
http://www.users.on.net/~kenj/pcp/coverity-pmlogger.html

Thanks.

Changes committed to git://oss.sgi.com/kenj/pcp.git dev

 src/include/impl.h        |    8 ++++----
 src/libpcp/src/optfetch.c |   19 ++++++++++---------
 src/pmcd/src/config.c     |   25 ++++++++++++++++++++-----
 src/pmcd/src/dopdus.c     |    4 +++-
 src/pmcd/src/dostore.c    |    2 ++
 src/pmcd/src/pmcd.c       |    7 ++++---
 src/pmlogger/callback.c   |    4 ++++
 src/pmlogger/check.c      |    4 +++-
 src/pmlogger/dopdu.c      |   27 ++++++++++++---------------
 src/pmlogger/fetch.c      |    4 +---
 src/pmlogger/gram.y       |    8 ++------
 src/pmlogger/logger.h     |    1 +
 src/pmlogger/pmlogger.c   |    1 +
 src/pmlogger/preamble.c   |   46 +++++++++++++++++++++++++++++-----------------
 14 files changed, 96 insertions(+), 64 deletions(-)

commit 42e5c468542cbf31b6aeb231ccfed7e547641e25
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 07:12:32 2012 +1100

    pmlogger/dopdu.c - use_after_free
    Original Coverity case #322
    http://people.redhat.com/mgoodwin/pcp-cov/1/322dopdu.c.html#error
    
    Yep, a real bug this time.

commit 1ce5353799984c869a8431b2b5dffab971ada235
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 07:00:15 2012 +1100

    pmlogger/fetch.c - resource_leak
    Original Coverity case #162
    http://people.redhat.com/mgoodwin/pcp-cov/1/162fetch.c.html#error
    
    No real problem here (newlist is not set in __dmprefetch() if newcnt
    <= numpmid on return) ... cosmetic code rearrangement to try and stop
    Coverity complaining.

commit fd0c0ba0bb4e60e7488d90418fe9e5a1489daabe
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 06:51:28 2012 +1100

    pmlogger/preamble.c - resource_leak
    Original Coverity cases #158 and #232
    http://people.redhat.com/mgoodwin/pcp-cov/1/158preamble.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/232preamble.c.html#error
    
    Rework the freeing of memory on the error branches.

commit 2c9ea484ff5be1dfaaf4dfa4d12c3d5b24633191
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 06:40:10 2012 +1100

    pmlogger/pmlogger.c - resource_leak
    Original Coverity case #150
    http://people.redhat.com/mgoodwin/pcp-cov/1/150pmlogger.c.html#error
    
    After calling pmParseInterval(), free(errmsg) in success.

commit 5612bbd1431e0bf155989881f53155059eccbd72
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 06:31:11 2012 +1100

    pmlogger/callback.c - negative_returns
    Original Coverity cases #96, #97 and #114.
    http://people.redhat.com/mgoodwin/pcp-cov/1/96pmns.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/97pmns.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/114pmns.c.html#error
    
    In all the places where we use the results from ftell() in a subsequent
    call to fseek(), add an assert() to ensure the ftell() result is >=
    0 ... the error cases should not happen and are only expected by Coverity!

commit bcf0c68ef883fbeb3f36c5896cddd5c847d662f9
Author: Ken McDonell <kenj at internode.on.net>
Date:   Sat Feb 4 06:19:28 2012 +1100

    pmlogger/dopdu.c - forward_null
    Original Coverity case #46
    http://people.redhat.com/mgoodwin/pcp-cov/1/46dopdu.c.html#error
    
    Code was correct, added an assert() to reinforce the fact that
    hp is not null after the __pmHashSearch() loop.

commit bc1f2d946267a1906272c1dd85022d4a85cff1ae
Author: Ken McDonell <kenj at internode.on.net>
Date:   Fri Feb 3 20:34:18 2012 +1100

    pmlogger/check.c - checked_return
    Original Coverity case #11
    http://people.redhat.com/mgoodwin/pcp-cov/1/11check.c.html#error
    
    Fixing the problem by changing the prototypes for some of the
    __pmOptFetch*() routines that can only ever return with success
    from type int to type void.

commit 9dbb058f206c2a7507f9cd7efee6e705eccc61a1
Author: Ken McDonell <kenj at internode.on.net>
Date:   Thu Feb 2 07:03:38 2012 +1100

    pmcd/pmcd.c - stray_semicolon
    Original Coverity case #295
    http://people.redhat.com/mgoodwin/pcp-cov/1/295dostore.c.html#error
    
    Replace null statement (added to placate gcc!) with an assert() ...
    we _really_ do expect the dup() call to succeed!

commit 239b2a8bf8aeefa1d8af7228c9833864a794eced
Author: Ken McDonell <kenj at internode.on.net>
Date:   Thu Feb 2 06:57:13 2012 +1100

    pmcd/dopdus.c - null_returns
    Original Coverity case #205
    http://people.redhat.com/mgoodwin/pcp-cov/1/205dostore.c.html#error
    
    Conditionally free(name) before returning on error branch.

commit c2ade890d40ed7ec4c6584e60cb529df4e74bb50
Author: Ken McDonell <kenj at internode.on.net>
Date:   Thu Feb 2 06:49:21 2012 +1100

    pmcd/config.c - resource_leak
    Original Coverity cases #169, #170, #192, #194 and #218
    http://people.redhat.com/mgoodwin/pcp-cov/1/169dostore.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/170dostore.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/192dostore.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/194dostore.c.html#error
    http://people.redhat.com/mgoodwin/pcp-cov/1/218dostore.c.html#error
    
    Clean up partial malloc()s on various error branches when syntax
    errors found in pmcd configuration file lines.

commit 0dfb8a11100a858e0bf610f9c63f88036db7bc50
Author: Ken McDonell <kenj at internode.on.net>
Date:   Tue Jan 31 20:55:11 2012 +1100

    pmcd/dostore.c - null_returns
    Original Coverity case #127
    http://people.redhat.com/mgoodwin/pcp-cov/1/127dostore.c.html#error
    
    Add assert(), as ap is guaranteed to be non-NULL in this case thanks
    to earlier grouping by domain in SplitResult().





More information about the pcp mailing list