Re: New Defects reported by Coverity Scan for ceph

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

 



Haomai, may want to double-check the pointer arithmetic here (and/or add a 
cast to make coverity less suspicious).

sage


On Sat, 27 Dec 2014, scan-admin@xxxxxxxxxxxx wrote:

> 
> Hi,
> 
> Please find the latest report on new defect(s) introduced to ceph found with Coverity Scan.
> 
> 1 new defect(s) introduced to ceph found with Coverity Scan.
> 1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
> 
> New defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
> 
> 
> ** CID 1260497:  Extra sizeof expression  (SIZEOF_MISMATCH)
> /msg/async/Event.cc: 123 in EventCenter::create_file_event(int, int, std::tr1::shared_ptr<EventCallback>)()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 1260497:  Extra sizeof expression  (SIZEOF_MISMATCH)
> /msg/async/Event.cc: 123 in EventCenter::create_file_event(int, int, std::tr1::shared_ptr<EventCallback>)()
> 117         }
> 118         FileEvent *new_events = static_cast<FileEvent *>(realloc(file_events, sizeof(FileEvent)*new_size));
> 119         if (!new_events) {
> 120           lderr(cct) << __func__ << " failed to realloc file_events" << cpp_strerror(errno) << dendl;
> 121           return -errno;
> 122         }
> >>>     CID 1260497:  Extra sizeof expression  (SIZEOF_MISMATCH)
> >>>     Adding "40UL /* sizeof (EventCenter::FileEvent) */ * this->nevent" to pointer "this->file_events" of type "EventCenter::FileEvent *" is suspicious because adding an integral value to this pointer automatically scales that value by the size, 40 bytes, of the pointed-to type, "EventCenter::FileEvent".  Most likely, the multiplication by "sizeof (EventCenter::FileEvent)" in this expression is extraneous and should be eliminated.
> 123         memset(file_events+sizeof(FileEvent)*nevent, 0, sizeof(FileEvent)*(new_size-nevent));
> 124         file_events = new_events;
> 125         nevent = new_size;
> 126       }
> 127     
> 128       EventCenter::FileEvent *event = _get_file_event(fd);
> 
> 
> ________________________________________________________________________________________________________
> To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/25?tab=overview
> 
> To manage Coverity Scan email notifications for "ceph-devel@xxxxxxxxxxxxxxx", click http://scan.coverity.com/subscriptions/edit?email=ceph-devel%40vger.kernel.org&token=018084d671e3cc89d00dd2ccb7eb849c .
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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