[Drbd-dev] drbd: Protect accesses to the uuid set with a spinlock

Philipp Reisner philipp.reisner at linbit.com
Fri Nov 16 12:57:56 CET 2012


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

> 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


More information about the drbd-dev mailing list