* [PATCH] pinctrl: palmas: fix a possible NULL dereference
@ 2016-08-16 8:36 LABBE Corentin
2016-08-22 12:11 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: LABBE Corentin @ 2016-08-16 8:36 UTC (permalink / raw)
To: linus.walleij; +Cc: linux-gpio, linux-kernel, LABBE Corentin
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 1009:
pinctrl_data = match->data;
For fixing this problem, we use of_device_get_match_data(), this will
simplify the code a little by using a standard function for
getting the match data.
Reported-by: coverity (CID 1324136)
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
drivers/pinctrl/pinctrl-palmas.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-palmas.c b/drivers/pinctrl/pinctrl-palmas.c
index 8edb3f8c..a30146d 100644
--- a/drivers/pinctrl/pinctrl-palmas.c
+++ b/drivers/pinctrl/pinctrl-palmas.c
@@ -1004,9 +1004,7 @@ static int palmas_pinctrl_probe(struct platform_device *pdev)
bool enable_dvfs2 = false;
if (pdev->dev.of_node) {
- const struct of_device_id *match;
- match = of_match_device(palmas_pinctrl_of_match, &pdev->dev);
- pinctrl_data = match->data;
+ pinctrl_data = of_device_get_match_data(&pdev->dev);
enable_dvfs1 = of_property_read_bool(pdev->dev.of_node,
"ti,palmas-enable-dvfs1");
enable_dvfs2 = of_property_read_bool(pdev->dev.of_node,
--
2.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] pinctrl: palmas: fix a possible NULL dereference
2016-08-16 8:36 [PATCH] pinctrl: palmas: fix a possible NULL dereference LABBE Corentin
@ 2016-08-22 12:11 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-08-22 12:11 UTC (permalink / raw)
To: LABBE Corentin; +Cc: linux-gpio, linux-kernel
On Tue, Aug 16, 2016 at 10:36 AM, LABBE Corentin
<clabbe.montjoie@gmail.com> wrote:
> of_match_device could return NULL, and so cause a NULL pointer
> dereference later at line 1009:
> pinctrl_data = match->data;
>
> For fixing this problem, we use of_device_get_match_data(), this will
> simplify the code a little by using a standard function for
> getting the match data.
>
> Reported-by: coverity (CID 1324136)
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-22 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 8:36 [PATCH] pinctrl: palmas: fix a possible NULL dereference LABBE Corentin
2016-08-22 12:11 ` Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.