Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1223950 > unrolled thread

[PATCH] mfd: wm831x: Fix possible NULL pointer dereference

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2015-09-14 11:10 +0200
Last post2015-09-20 06:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Javier Martinez Canillas <javier@osg.samsung.com> - 2015-09-14 11:10 +0200
    Re: [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2015-09-14 11:40 +0200
    Re: [PATCH] mfd: wm831x: Fix possible NULL pointer dereference Lee Jones <lee.jones@linaro.org> - 2015-09-20 06:20 +0200

#1223950 — [PATCH] mfd: wm831x: Fix possible NULL pointer dereference

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2015-09-14 11:10 +0200
Subject[PATCH] mfd: wm831x: Fix possible NULL pointer dereference
Message-ID<q8xVV-1GG-23@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1223973

FromCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Date2015-09-14 11:40 +0200
Message-ID<q8yoW-2gE-21@gated-at.bofh.it>
In reply to#1223950
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1228822

FromLee Jones <lee.jones@linaro.org>
Date2015-09-20 06:20 +0200
Message-ID<qaEgy-5MM-17@gated-at.bofh.it>
In reply to#1223950
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web