diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-07-11 13:19:38 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-26 08:36:39 +0200 |
commit | 9667a5eb5b1254d3c39052aff3459df3080f6cd3 (patch) | |
tree | 223675de7cba3ae9df75c57b9a62898d816ccf1d /drivers/gpio/gpiolib.h | |
parent | eb543ccfb0bf456f1507725b56960e51890beaa1 (diff) |
gpio: pxa: Fix potential NULL dereference
[ Upstream commit 9506755633d0b32ef76f67c345000178e9b0dfc4 ]
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(e1, res->start, e2);
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
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>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
0 files changed, 0 insertions, 0 deletions