]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth/cephx: always initialize local variables 31154/head
authorKefu Chai <kchai@redhat.com>
Fri, 25 Oct 2019 08:42:55 +0000 (16:42 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 25 Oct 2019 08:44:53 +0000 (16:44 +0800)
to silence GCC warnings like:

rc/auth/cephx/CephxProtocol.h:309:5: warning: 'type' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (i != tickets_map.end())
     ^~

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/auth/cephx/CephxProtocol.cc

index 1824d53039e334411a3f9ee954b3d1edca5eb9d4..ef95b66aa1c2e19285823178906ee8eba64dfa33 100644 (file)
@@ -278,7 +278,7 @@ bool CephXTicketManager::verify_service_ticket_reply(CryptoKey& secret,
                                                     bufferlist::const_iterator& indata)
 {
   __u8 service_ticket_reply_v;
-  uint32_t num;
+  uint32_t num = 0;
   try {
     decode(service_ticket_reply_v, indata);
     decode(num, indata);
@@ -289,7 +289,7 @@ bool CephXTicketManager::verify_service_ticket_reply(CryptoKey& secret,
   ldout(cct, 10) << "verify_service_ticket_reply got " << num << " keys" << dendl;
 
   for (int i=0; i<(int)num; i++) {
-    uint32_t type;
+    uint32_t type = 0;
     try {
       decode(type, indata);
     } catch (buffer::error& e) {