[DRBD-user] drbd: refactor use of first_peer_device()

Dan Carpenter dan.carpenter at oracle.com
Fri Jul 11 16:08:13 CEST 2014

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


[ For some reason I was looking at old warnings and this showed up.
  Sorry for sending these a long time after the fact.  - dan ]

Hello Lars Ellenberg,

This is a semi-automatic email about new static checker warnings.

The patch 44a4d551846b: "drbd: refactor use of first_peer_device()"
from Nov 22, 2013, leads to the following Smatch complaint:

drivers/block/drbd/drbd_nl.c:688 drbd_set_role()
	 error: we previously assumed 'peer_device' could be null (see line 560)

drivers/block/drbd/drbd_nl.c
   559		struct drbd_peer_device *const peer_device = first_peer_device(device);
   560		struct drbd_connection *const connection = peer_device ? peer_device->connection : NULL;
                                                           ^^^^^^^^^^^
Check.

   561		const int max_tries = 4;
   562		enum drbd_state_rv rv = SS_UNKNOWN_ERROR;
   563		struct net_conf *nc;
   564		int try = 0;
   565		int forced = 0;
   566		union drbd_state mask, val;
   567	

[ snip ]

   684	
   685		if (device->state.conn >= C_WF_REPORT_PARAMS) {
   686			/* if this was forced, we should consider sync */
   687			if (forced)
   688				drbd_send_uuids(peer_device);
                                                ^^^^^^^^^^^
Dereferenced inside the function.

   689			drbd_send_current_state(peer_device);
   690		}

regards,
dan carpenter



More information about the drbd-user mailing list