1
0
Fork 0
remarkable-linux/drivers/pinctrl/bcm
Wei Yongjun b6fadd93ad pinctrl: nsp: Fix potential NULL dereference
[ Upstream commit c29e9da56b ]

platform_get_resource() may fail and return NULL, so we should
better check it's return value to avoid a NULL pointer dereference
a bit later in the code.

This is detected by Coccinelle semantic patch.

@@
expression pdev, res, n, t, e, e1, e2;
@@

res = platform_get_resource(pdev, t, n);
+ if (!res)
+   return -EINVAL;
... when != res == NULL
e = devm_ioremap_nocache(e1, res->start, e2);

Fixes: cc4fa83f66 ("pinctrl: nsp: add pinmux driver support for Broadcom NSP SoC")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-24 13:09:17 +02:00
..
Kconfig scripts/spelling.txt: add "overrided" pattern and fix typo instances 2017-02-27 18:43:47 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pinctrl-bcm281xx.c pinctrl: bcm281xx: constify pinconf_ops, pinctrl_ops, and pinmux_ops structures 2017-08-22 14:36:25 +02:00
pinctrl-bcm2835.c pinctrl: bcm2835: fix build warning in bcm2835_gpio_irq_handle_bank 2017-09-21 14:11:10 +02:00
pinctrl-cygnus-mux.c pinctrl: bcm: cleanup Broadcom license headers 2017-06-09 11:09:43 +02:00
pinctrl-iproc-gpio.c pinctrl: bcm: cleanup Broadcom license headers 2017-06-09 11:09:43 +02:00
pinctrl-ns2-mux.c pinctrl: Widen the generic pinconf argument from 16 to 24 bits 2017-01-26 15:22:32 +01:00
pinctrl-nsp-gpio.c pinctrl: bcm: cleanup Broadcom license headers 2017-06-09 11:09:43 +02:00
pinctrl-nsp-mux.c pinctrl: nsp: Fix potential NULL dereference 2018-08-24 13:09:17 +02:00