New Defects reported by Coverity Scan for ceph
Hi,
Please find the latest report on new defect(s) introduced to ceph found with Coverity Scan.
2 new defect(s) introduced to ceph found with Coverity Scan.
New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)
** CID 1262114: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()()
** CID 1262115: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOpReply.h: 97 in MOSDRepOpReply::MOSDRepOpReply()()
________________________________________________________________________________________________________
*** CID 1262114: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()()
101 ::encode(from, payload); 102 ::encode(updated_hit_set_history, payload); 103 ::encode(pg_trim_rollback_to, payload);
104 }
105
106 MOSDRepOp()
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1262114: Uninitialized scalar field (
UNINIT_CTOR)
Non-static class member "acks_wanted" is not initialized in this constructor nor in any functions that it calls.
107 : Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION) { }
108 MOSDRepOp(osd_reqid_t r, pg_shard_t from,
109 spg_t p, const hobject_t& po, int aw, 110 epoch_t mape, ceph_tid_t rtid, eversion_t v)
111 : Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION),
112 map_epoch(mape),
________________________________________________________________________________________________________
*** CID 1262115: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOpReply.h: 97 in MOSDRepOpReply::MOSDRepOpReply()()
91 from(from),
92 pgid(req->pgid.pgid, req->from.shard),
93 ack_type(at),
94 result(result_) {
95 set_tid(req->get_tid());96 }
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1262115: Uninitialized scalar field (
UNINIT_CTOR)
Non-static class member "result" is not initialized in this constructor nor in any functions that it calls.
97 MOSDRepOpReply() : Message(MSG_OSD_REPOPREPLY) {}
98 private:
99 ~MOSDRepOpReply() {}
100
101 public:
102 const char *get_type_name() const { return "osd_repop_reply"; }
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/25?tab=overview
To manage Coverity Scan email notifications for "[email protected]", click http://scan.coverity.com/subscriptions/edit?email=ceph-devel%40vger.kernel.org&token=018084d671e3cc89d00dd2ccb7eb849c .
Quoted 34 lines · On Fri, 9 Jan 2015, [email protected] wrote:
** CID 1262114: Uninitialized scalar field (
UNINIT_CTOR) /messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()()** CID 1262115: Uninitialized scalar field (
UNINIT_CTOR) /messages/MOSDRepOpReply.h: 97 in MOSDRepOpReply::MOSDRepOpReply()()________________________________________________________________________________________________________
*** CID 1262114: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()()101 ::encode(from, payload); 102 ::encode(updated_hit_set_history, payload); 103 ::encode(pg_trim_rollback_to, payload);104 }
105
106MOSDRepOp()Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1262114: Uninitialized scalar field (
UNINIT_CTOR)
Non-static class member "acks_wanted" is not initialized in this constructor nor in any functions that it calls.107 :
Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION){ }
108 MOSDRepOp(osd_reqid_t r,pg_shard_tfrom,109 spg_t p, const hobject_t& po, int aw, 110 epoch_t mape, ceph_tid_t rtid, eversion_t v)111 :
Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION),
112map_epoch(mape),________________________________________________________________________________________________________
*** CID 1262115: Uninitialized scalar field (UNINIT_CTOR) /messages/MOSDRepOpReply.h: 97 in MOSDRepOpReply::MOSDRepOpReply()()91 from(from), 92 pgid(req->pgid.pgid, req->from.shard), 93 ack_type(at), 94 result(result_) { 95 set_tid(req->get_tid());96 }
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1262115: Uninitialized scalar field (
UNINIT_CTOR)
Non-static class member "result" is not initialized in this constructor nor in any functions that it calls.97
MOSDRepOpReply():Message(MSG_OSD_REPOPREPLY){}
98 private:
99 ~MOSDRepOpReply() {}
100
101 public:
102 const char*get_type_name()const { return "osd_repop_reply"; }
These are both warnings about the trivial constructors,
Quoted 4 lines
106
MOSDRepOp()Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1262114: Uninitialized scalar field (
UNINIT_CTOR)
Non-static class member "acks_wanted" is not initialized in this constructor nor in any functions that it calls.107 :
Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION){ }
which are always followed by a ::decode. We don't initialize fields in any of these so we probably have these coverity warnings for every message. Perhaps we should add some annotations to indicate that? Danny, are you familiar with those?
(I don't think we want to initialize... unless we rely on the optimizer to do magic it's inefficient to initialize the value and then overwrite it during decode shortly after.)
sage
Am 09.01.2015 um 16:26 schrieb Sage Weil:
Quoted 12 lines · On Fri, 9 Jan 2015, [email protected] wrote:
Quoted 11 lines
** CID 1262114: Uninitialized scalar field (
UNINIT_CTOR) /messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()()** CID 1262115: Uninitialized scalar field (
UNINIT_CTOR) /messages/MOSDRepOpReply.h: 97 in MOSDRepOpReply::MOSDRepOpReply()()________________________________________________________________________________________________________
*** CID 1262114: Uninitialized scalar field (UNINIT_CTOR)
Quoted 15 lines
Quoted 15 lines
/messages/MOSDRepOp.h: 107 in MOSDRepOp::MOSDRepOp()() 101 ::encode(from, payload); 102 ::encode(updated_hit_set_history, payload); 103
::encode(pg_trim_rollback_to, payload); 104 } 105 106MOSDRepOp()Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
CID 1262114: Uninitialized scalar field (
UNINIT_CTOR) Non-static class member "acks_wanted" is not initialized in this constructor nor in any functions that it calls.107 : Message(MSG_OSD_REPOP,
HEAD_VERSION,COMPAT_VERSION) { } 108 MOSDRepOp(osd_reqid_t r,pg_shard_t
from, 109spg_tp, const hobject_t& po, int aw, 110epoch_tmape,ceph_tid_trtid,eversion_tv) 111 :Message(MSG_OSD_REPOP, HEAD_VERSION, COMPAT_VERSION), 112map_epoch(mape),
Quoted 3 lines
Quoted 3 lines
________________________________________________________________________________________________________
*** CID 1262115: Uninitialized scalar field (UNINIT_CTOR)
Quoted 26 lines
Quoted 11 lines
/messages/MOSDRepOpReply.h: 97 in
MOSDRepOpReply::MOSDRepOpReply()() 91 from(from), 92pgid(req->pgid.pgid, req->from.shard), 93ack_type(at),
94result(result_){ 95 set_tid(req->get_tid());
96 }Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
CID 1262115: Uninitialized scalar field (
UNINIT_CTOR) Non-static class member "result" is not initialized in this constructor nor in any functions that it calls.97
MOSDRepOpReply():Message(MSG_OSD_REPOPREPLY){} 98
private: 99 ~MOSDRepOpReply() {} 100 101 public: 102
const char*get_type_name()const { return "osd_repop_reply"; }These are both warnings about the trivial constructors,
Quoted 6 lines
106
MOSDRepOp()Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
CID 1262114: Uninitialized scalar field (
UNINIT_CTOR) Non-static class member "acks_wanted" is not initialized in this constructor nor in any functions that it calls.107 : Message(MSG_OSD_REPOP,
HEAD_VERSION,COMPAT_VERSION) { }which are always followed by a ::decode. We don't initialize fields in any of these so we probably have these coverity warnings for every message. Perhaps we should add some annotations to indicate that? Danny, are you familiar with those?
Quoted 5 lines
(I don't think we want to initialize... unless we rely on the optimizer to do magic it's inefficient to initialize the value and then overwrite it during decode shortly after.)
sage
I will take a look into it.
Danny