Avoid NULL dereference in a couple of sysctl handlers in ibcore.

iw_cxgbe sets ib_device->dma_device to NULL (since r311880).

Reviewed by:	hselasky@
Sponsored by:	Chelsio Communications
This commit is contained in:
np 2017-02-23 07:48:58 +00:00
parent ae9b952c70
commit 4d1144ae43

View File

@ -1225,7 +1225,7 @@ show_dev_device(struct device *device, struct device_attribute *attr, char *buf)
{
struct ib_uverbs_device *dev = dev_get_drvdata(device);
if (!dev)
if (!dev || !dev->ib_dev->dma_device)
return -ENODEV;
return sprintf(buf, "0x%04x\n",
@ -1238,7 +1238,7 @@ show_dev_vendor(struct device *device, struct device_attribute *attr, char *buf)
{
struct ib_uverbs_device *dev = dev_get_drvdata(device);
if (!dev)
if (!dev || !dev->ib_dev->dma_device)
return -ENODEV;
return sprintf(buf, "0x%04x\n",