[PATCH 11/16] bcache: Check the d->disk pointer before using it

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

 



Since bcache_device_free() checks the d->disk pointer I think that
means that that pointer can be NULL. Hence test that pointer before
using it. This was detected by smatch.

Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx>
---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index d19a44cd1fd7..39bec137f636 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -742,7 +742,7 @@ static void bcache_device_free(struct bcache_device *d)
 {
 	lockdep_assert_held(&bch_register_lock);
 
-	pr_info("%s stopped", d->disk->disk_name);
+	pr_info("%s stopped", d->disk ? d->disk->disk_name : "(?)");
 
 	if (d->c)
 		bcache_device_detach(d);
-- 
2.16.2




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux