From 770b443e747a046caddd280aabeb6fc0dbefa3ce Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 25 Oct 2019 16:42:55 +0800 Subject: [PATCH] auth/cephx: always initialize local variables 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 --- src/auth/cephx/CephxProtocol.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auth/cephx/CephxProtocol.cc b/src/auth/cephx/CephxProtocol.cc index 1824d53039e33..ef95b66aa1c2e 100644 --- a/src/auth/cephx/CephxProtocol.cc +++ b/src/auth/cephx/CephxProtocol.cc @@ -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) { -- 2.39.5