Skip to contentSkip to conversation

drbd: Protect accesses to the uuid set with a spinlock

Drbd-dev Philipp Reisner 1 participant 1 message Nov 16, 2012 1 message not in the archive DRBD driver

lore
Share & tools
lore

Philipp Reisner

author maintainer
#1 lore raw
In reply to a message not in the archive

Hi Dan,

Thanks for the report. I have removed the redundant check. See here:

http://git.drbd.org/gitweb.cgi?p=linux-drbd.git;a=commitdiff;h=fdba05e9248f17dba3227c95ec25b498057e3109;hp=8d0ff3924bbad9fc53c3cc305d317033b16a5f05

Best regards,
Phil

Quoted 30 lines

Hello Philipp Reisner,

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

The patch 9f2247bb9b75: "drbd: Protect accesses to the uuid set with a spinlock" from Aug 16, 2012, leads to the following Smatch complaint:

drivers/block/drbd/drbd_main.c:843 _drbd_send_uuids()

	 warn: variable dereferenced before check 'mdev->ldev' (see line 841)

drivers/block/drbd/drbd_main.c
840 }

   841		spin_lock_irq(&mdev->ldev->md.uuid_lock);
                              ^^^^^^^^^^^^^

New dereference.

   842		for (i = UI_CURRENT; i < UI_SIZE; i++)
   843			p->uuid[i] = mdev->ldev ? cpu_to_be64(mdev->ldev->md.uuid[i]) : 0;
                                     ^^^^^^^^^^

Old check.

   844		spin_unlock_irq(&mdev->ldev->md.uuid_lock);
                                 ^^^^^^^^^^^^

New dereference.

   845

regards,
dan carpenter