]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
AsyncMessenger.cc: fix FORWARD_NULL
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 21 Feb 2017 13:31:53 +0000 (14:31 +0100)
committerKefu Chai <kchai@redhat.com>
Mon, 10 Apr 2017 10:16:17 +0000 (18:16 +0800)
Use assert to ensure Message *m is not NULL.

Fix for:

CID 1399578 (#4 of 4): Dereference after null check (FORWARD_NULL)
 var_deref_model: Passing null pointer m to submit_message,
 which dereferences it.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/msg/async/AsyncMessenger.cc

index f7fc213fe304350e93ddb02f7736fe8ed5752fe2..b6345523747e681b6be5bda43013be9a81b64fb5 100644 (file)
@@ -533,9 +533,11 @@ ConnectionRef AsyncMessenger::get_loopback_connection()
 int AsyncMessenger::_send_message(Message *m, const entity_inst_t& dest)
 {
   FUNCTRACE();
-  if (m && m->get_type() == CEPH_MSG_OSD_OP)
+  assert(m);
+
+  if (m->get_type() == CEPH_MSG_OSD_OP)
     OID_EVENT_TRACE(((MOSDOp *)m)->get_oid().name.c_str(), "SEND_MSG_OSD_OP");
-  else if (m && m->get_type() == CEPH_MSG_OSD_OPREPLY)
+  else if (m->get_type() == CEPH_MSG_OSD_OPREPLY)
     OID_EVENT_TRACE(((MOSDOpReply *)m)->get_oid().name.c_str(), "SEND_MSG_OSD_OP_REPLY");
 
   ldout(cct, 1) << __func__ << "--> " << dest.name << " "