* [PATCH] mfd: wm831x: Fix possible NULL pointer dereference
@ 2015-09-14 9:07 Javier Martinez Canillas
2015-09-14 9:08 ` Charles Keepax
2015-09-20 4:18 ` Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2015-09-14 9:07 UTC (permalink / raw)
To: linux-kernel; +Cc: Javier Martinez Canillas, Lee Jones, patches, Samuel Ortiz
The driver always checks for pdata being NULL expect in one place.
Add a check to prevent a possible NULL pointer deference error.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/mfd/wm831x-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 28366a90e1ad..3e0e99ec5836 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1626,7 +1626,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
mutex_init(&wm831x->io_lock);
mutex_init(&wm831x->key_lock);
dev_set_drvdata(wm831x->dev, wm831x);
- wm831x->soft_shutdown = pdata->soft_shutdown;
+
+ if (pdata)
+ wm831x->soft_shutdown = pdata->soft_shutdown;
ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
if (ret < 0) {
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: wm831x: Fix possible NULL pointer dereference
2015-09-14 9:07 [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Javier Martinez Canillas
@ 2015-09-14 9:08 ` Charles Keepax
2015-09-20 4:18 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2015-09-14 9:08 UTC (permalink / raw)
To: Javier Martinez Canillas; +Cc: linux-kernel, Lee Jones, patches, Samuel Ortiz
On Mon, Sep 14, 2015 at 11:07:56AM +0200, Javier Martinez Canillas wrote:
> The driver always checks for pdata being NULL expect in one place.
> Add a check to prevent a possible NULL pointer deference error.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>
> ---
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mfd: wm831x: Fix possible NULL pointer dereference
2015-09-14 9:07 [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Javier Martinez Canillas
2015-09-14 9:08 ` Charles Keepax
@ 2015-09-20 4:18 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2015-09-20 4:18 UTC (permalink / raw)
To: Javier Martinez Canillas; +Cc: linux-kernel, patches, Samuel Ortiz
On Mon, 14 Sep 2015, Javier Martinez Canillas wrote:
> The driver always checks for pdata being NULL expect in one place.
> Add a check to prevent a possible NULL pointer deference error.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>
> ---
>
> drivers/mfd/wm831x-core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
NB: I'll also try to remember to fix-up the spelling error in the
commit log.
> diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
> index 28366a90e1ad..3e0e99ec5836 100644
> --- a/drivers/mfd/wm831x-core.c
> +++ b/drivers/mfd/wm831x-core.c
> @@ -1626,7 +1626,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
> mutex_init(&wm831x->io_lock);
> mutex_init(&wm831x->key_lock);
> dev_set_drvdata(wm831x->dev, wm831x);
> - wm831x->soft_shutdown = pdata->soft_shutdown;
> +
> + if (pdata)
> + wm831x->soft_shutdown = pdata->soft_shutdown;
>
> ret = wm831x_reg_read(wm831x, WM831X_PARENT_ID);
> if (ret < 0) {
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-20 4:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 9:07 [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Javier Martinez Canillas
2015-09-14 9:08 ` Charles Keepax
2015-09-20 4:18 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox