From: Danny Al-Gaaf Date: Wed, 18 Mar 2015 10:12:51 +0000 (+0100) Subject: client/Client.cc: fix uninit variables X-Git-Tag: v9.0.1~128^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8077b5232d2d5c090bb08de22e7b844cd39f0fce;p=ceph.git client/Client.cc: fix uninit variables This is caused by assert(). If assert is disabled we run into use of uninitialized variables. Return -EINVAL in case assert() is disabled. Fix for: [src/client/Client.cc:7791]: (error) Uninitialized variable: lock_state [src/client/Client.cc:7829]: (error) Uninitialized variable: lock_type Signed-off-by: Danny Al-Gaaf --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 4262cced2001..01d2a6008481 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7799,8 +7799,10 @@ int Client::_do_filelock(Inode *in, Fh *fh, int lock_type, int op, int sleep, if (!in->flock_locks) in->flock_locks = new ceph_lock_state_t(cct); lock_state = in->flock_locks; - } else + } else { assert(0); + return -EINVAL; + } _update_lock_state(fl, owner, lock_state); if (fh) { @@ -7830,8 +7832,10 @@ int Client::_interrupt_filelock(MetaRequest *req) lock_type = CEPH_LOCK_FLOCK_INTR; else if (req->head.args.filelock_change.rule == CEPH_LOCK_FCNTL) lock_type = CEPH_LOCK_FCNTL_INTR; - else + else { assert(0); + return -EINVAL; + } MetaRequest *intr_req = new MetaRequest(CEPH_MDS_OP_SETFILELOCK); filepath path;