Commit 3ae279d2 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Bottomley

[SCSI] target: iblock/pscsi claim checking for NULL instead of IS_ERR

blkdev_get_by_path() returns an ERR_PTR() or error and it doesn't return
a NULL.  It looks like this bug would be easy to trigger by mistake.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarNicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent a361cc00
...@@ -154,7 +154,7 @@ static struct se_device *iblock_create_virtdevice( ...@@ -154,7 +154,7 @@ static struct se_device *iblock_create_virtdevice(
bd = blkdev_get_by_path(ib_dev->ibd_udev_path, bd = blkdev_get_by_path(ib_dev->ibd_udev_path,
FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev); FMODE_WRITE|FMODE_READ|FMODE_EXCL, ib_dev);
if (!(bd)) if (IS_ERR(bd))
goto failed; goto failed;
/* /*
* Setup the local scope queue_limits from struct request_queue->limits * Setup the local scope queue_limits from struct request_queue->limits
......
...@@ -462,8 +462,8 @@ static struct se_device *pscsi_create_type_disk( ...@@ -462,8 +462,8 @@ static struct se_device *pscsi_create_type_disk(
*/ */
bd = blkdev_get_by_path(se_dev->se_dev_udev_path, bd = blkdev_get_by_path(se_dev->se_dev_udev_path,
FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv); FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv);
if (!(bd)) { if (IS_ERR(bd)) {
printk("pSCSI: blkdev_get_by_path() failed\n"); printk(KERN_ERR "pSCSI: blkdev_get_by_path() failed\n");
scsi_device_put(sd); scsi_device_put(sd);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment