diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-04-28 19:19:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-28 22:34:04 -0400 |
commit | 99f23c2cded85a377325aa9fd374ffa3d55d1088 (patch) | |
tree | 9bf18f1185d2c316ac58a2f9ca504c39c136b775 | |
parent | c2e7e00b715d3c65f301bec8559d6af4ef8098ab (diff) |
rapidio: fix potential NULL pointer dereference
The change fixes improper check for a returned error value by
class_create() function, which on error returns ERR_PTR() value, thus the
original check always results in a dead code on error path.
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/rapidio/devices/rio_mport_cdev.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c index 5d4d91846357..96168b819044 100644 --- a/drivers/rapidio/devices/rio_mport_cdev.c +++ b/drivers/rapidio/devices/rio_mport_cdev.c | |||
@@ -2669,9 +2669,9 @@ static int __init mport_init(void) | |||
2669 | 2669 | ||
2670 | /* Create device class needed by udev */ | 2670 | /* Create device class needed by udev */ |
2671 | dev_class = class_create(THIS_MODULE, DRV_NAME); | 2671 | dev_class = class_create(THIS_MODULE, DRV_NAME); |
2672 | if (!dev_class) { | 2672 | if (IS_ERR(dev_class)) { |
2673 | rmcd_error("Unable to create " DRV_NAME " class"); | 2673 | rmcd_error("Unable to create " DRV_NAME " class"); |
2674 | return -EINVAL; | 2674 | return PTR_ERR(dev_class); |
2675 | } | 2675 | } |
2676 | 2676 | ||
2677 | ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME); | 2677 | ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME); |