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:
Navdeep Parhar 2017-02-23 07:48:58 +00:00
parent 2495a63064
commit 3d4f452402
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314131

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",