New Defects reported by Coverity Scan for ceph (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Loic,

Do you mind looking at the PGLog.cc iterator issue coverity picked up on?

sage
--- Begin Message ---

Hi,

Please find the latest report on new defect(s) introduced to ceph found with Coverity Scan

Defect(s) Reported-by: Coverity Scan

	
** CID 1035577: Resource leak (RESOURCE_LEAK)
/test/libcephfs/multiclient.cc: 67

** CID 1035576: Resource leak (RESOURCE_LEAK)
/test/libcephfs/multiclient.cc: 32

** CID 1035575: Resource leak (RESOURCE_LEAK)
/test/libcephfs/multiclient.cc: 27

** CID 1035574: Using invalid iterator (INVALIDATE_ITERATOR)
/osd/PGLog.cc: 369


________________________________________________________________________
CID 1035577: Resource leak (RESOURCE_LEAK)

/test/libcephfs/multiclient.cc: 67 ( alloc_arg)
   64    
   65    TEST(LibCephFS, MulticlientHoleEOF) {
   66      struct ceph_mount_info *ca, *cb;
>>> "ceph_create(ceph_mount_info **, char const *)" allocates memory that is stored into "ca".
   67      ASSERT_EQ(ceph_create(&ca, NULL), 0);
   68      ASSERT_EQ(0, ceph_conf_parse_env(ca, NULL));
   69      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   70      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   71    
  

/test/libcephfs/multiclient.cc: 67 ( leaked_storage)
   64    
   65    TEST(LibCephFS, MulticlientHoleEOF) {
   66      struct ceph_mount_info *ca, *cb;
>>> CID 1035577: Resource leak (RESOURCE_LEAK)
>>> Variable "ca" going out of scope leaks the storage it points to.
   67      ASSERT_EQ(ceph_create(&ca, NULL), 0);
   68      ASSERT_EQ(0, ceph_conf_parse_env(ca, NULL));
   69      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   70      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   71    
  
________________________________________________________________________
CID 1035576: Resource leak (RESOURCE_LEAK)

/test/libcephfs/multiclient.cc: 32 ( alloc_arg)
   29      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   30      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   31    
>>> "ceph_create(ceph_mount_info **, char const *)" allocates memory that is stored into "cb".
   32      ASSERT_EQ(ceph_create(&cb, NULL), 0);
   33      ASSERT_EQ(0, ceph_conf_parse_env(cb, NULL));
   34      ASSERT_EQ(ceph_conf_read_file(cb, NULL), 0);
   35      ASSERT_EQ(ceph_mount(cb, NULL), 0);
   36    
  

/test/libcephfs/multiclient.cc: 32 ( leaked_storage)
   29      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   30      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   31    
>>> CID 1035576: Resource leak (RESOURCE_LEAK)
>>> Variable "cb" going out of scope leaks the storage it points to.
   32      ASSERT_EQ(ceph_create(&cb, NULL), 0);
   33      ASSERT_EQ(0, ceph_conf_parse_env(cb, NULL));
   34      ASSERT_EQ(ceph_conf_read_file(cb, NULL), 0);
   35      ASSERT_EQ(ceph_mount(cb, NULL), 0);
   36    
  
________________________________________________________________________
CID 1035575: Resource leak (RESOURCE_LEAK)

/test/libcephfs/multiclient.cc: 27 ( alloc_arg)
   24    
   25    TEST(LibCephFS, MulticlientSimple) {
   26      struct ceph_mount_info *ca, *cb;
>>> "ceph_create(ceph_mount_info **, char const *)" allocates memory that is stored into "ca".
   27      ASSERT_EQ(ceph_create(&ca, NULL), 0);
   28      ASSERT_EQ(0, ceph_conf_parse_env(ca, NULL));
   29      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   30      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   31    
  

/test/libcephfs/multiclient.cc: 27 ( leaked_storage)
   24    
   25    TEST(LibCephFS, MulticlientSimple) {
   26      struct ceph_mount_info *ca, *cb;
>>> CID 1035575: Resource leak (RESOURCE_LEAK)
>>> Variable "ca" going out of scope leaks the storage it points to.
   27      ASSERT_EQ(ceph_create(&ca, NULL), 0);
   28      ASSERT_EQ(0, ceph_conf_parse_env(ca, NULL));
   29      ASSERT_EQ(ceph_conf_read_file(ca, NULL), 0);
   30      ASSERT_EQ(ceph_mount(ca, NULL), 0);
   31    
  
________________________________________________________________________
CID 1035574: Using invalid iterator (INVALIDATE_ITERATOR)

/osd/PGLog.cc: 361 ( past_the_end)
   358      dout(10) << "rewind_divergent_log truncate divergent future " << newhead << dendl;
   359      assert(newhead > log.tail);
   360    
>>> Function "end" creates an iterator.
   361      list<pg_log_entry_t>::iterator p = log.log.end();
   362      list<pg_log_entry_t> divergent;
   363      while (true) {
   364        if (p == log.log.begin()) {
   365          // yikes, the whole thing is divergent!
  

/osd/PGLog.cc: 361 ( assign_var)
   358      dout(10) << "rewind_divergent_log truncate divergent future " << newhead << dendl;
   359      assert(newhead > log.tail);
   360    
>>> Assigning: "p" = "this->log.log.end()".
   361      list<pg_log_entry_t>::iterator p = log.log.end();
   362      list<pg_log_entry_t> divergent;
   363      while (true) {
   364        if (p == log.log.begin()) {
   365          // yikes, the whole thing is divergent!
  

/osd/PGLog.cc: 369 ( deref_iterator)
   366          divergent.swap(log.log);
   367          break;
   368        }
>>> CID 1035574: Using invalid iterator (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "p" though it is already past the end of its container.
   369        mark_dirty_from(p->version);
   370        --p;
   371        if (p->version == newhead) {
   372          ++p;
   373          divergent.splice(divergent.begin(), log.log, p, log.log.end());
  
________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com

To unsubscribe from the email notification for new defects, http://scan5.coverity.com/cgi-bin/unsubscribe.py


--- End Message ---

[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux