[ceph-client:wip-object-map 19/21] drivers/block/rbd.c:2125:21: warning: 'current_state' may be used uninitialized in this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://github.com/ceph/ceph-client.git wip-object-map
head:   b949866d3d5288f94ec8e129af2e8d44c9b270df
commit: db0a28e0a21f4432421b27c6ecd5d2368a4435ee [19/21] rbd: support for object-map and fast-diff
config: i386-randconfig-n004-201925 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-9) 7.4.0
reproduce:
        git checkout db0a28e0a21f4432421b27c6ecd5d2368a4435ee
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/block/rbd.c: In function 'rbd_object_map_callback':
>> drivers/block/rbd.c:2125:21: warning: 'current_state' may be used uninitialized in this function [-Wmaybe-uninitialized]
         (current_state == OBJECT_EXISTS && state == OBJECT_EXISTS_CLEAN))
   drivers/block/rbd.c:2093:23: note: 'current_state' was declared here
     u8 state, new_state, current_state;
                          ^~~~~~~~~~~~~

vim +/current_state +2125 drivers/block/rbd.c

  2076	
  2077	/*
  2078	 * This function needs snap_id (or more precisely just something to
  2079	 * distinguish between HEAD and snapshot object maps), new_state and
  2080	 * current_state that were passed to rbd_object_map_update().
  2081	 *
  2082	 * To avoid allocating and stashing a context we piggyback on the OSD
  2083	 * request.  A HEAD update has two ops (assert_locked).  For new_state
  2084	 * and current_state we decode our own object_map_update op, encoded in
  2085	 * rbd_cls_object_map_update().
  2086	 */
  2087	static int rbd_object_map_update_finish(struct rbd_obj_request *obj_req,
  2088						struct ceph_osd_request *osd_req)
  2089	{
  2090		struct rbd_device *rbd_dev = obj_req->img_request->rbd_dev;
  2091		struct ceph_osd_data *osd_data;
  2092		u64 objno;
  2093		u8 state, new_state, current_state;
  2094		bool has_current_state;
  2095		void *p;
  2096	
  2097		if (osd_req->r_result)
  2098			return osd_req->r_result;
  2099	
  2100		/*
  2101		 * Nothing to do for a snapshot object map.
  2102		 */
  2103		if (osd_req->r_num_ops == 1)
  2104			return 0;
  2105	
  2106		/*
  2107		 * Update in-memory HEAD object map.
  2108		 */
  2109		rbd_assert(osd_req->r_num_ops == 2);
  2110		osd_data = osd_req_op_data(osd_req, 1, cls, request_data);
  2111		rbd_assert(osd_data->type == CEPH_OSD_DATA_TYPE_PAGES);
  2112	
  2113		p = page_address(osd_data->pages[0]);
  2114		objno = ceph_decode_64(&p);
  2115		rbd_assert(objno == obj_req->ex.oe_objno);
  2116		rbd_assert(ceph_decode_64(&p) == objno + 1);
  2117		new_state = ceph_decode_8(&p);
  2118		has_current_state = ceph_decode_8(&p);
  2119		if (has_current_state)
  2120			current_state = ceph_decode_8(&p);
  2121	
  2122		spin_lock(&rbd_dev->object_map_lock);
  2123		state = __rbd_object_map_get(rbd_dev, objno);
  2124		if (!has_current_state || current_state == state ||
> 2125		    (current_state == OBJECT_EXISTS && state == OBJECT_EXISTS_CLEAN))
  2126			__rbd_object_map_set(rbd_dev, objno, new_state);
  2127		spin_unlock(&rbd_dev->object_map_lock);
  2128	
  2129		return 0;
  2130	}
  2131	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux