diff mbox

Prevent the NULL dereferencing

Message ID 1301997495-20876-1-git-send-email-shubhrajyoti@ti.com (mailing list archive)
State Accepted
Commit 8f74c0661c42104b3e3d2c032bc61efde15360ad
Headers show

Commit Message

Shubhrajyoti Datta April 5, 2011, 9:58 a.m. UTC
From: Shubhrajyoti D <a0393217@india.ti.com>


Signed-off-by: Shubhrajyoti D <a0393217@india.ti.com>
---
 drivers/input/keyboard/twl4030_keypad.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Shubhrajyoti Datta April 5, 2011, 10:25 a.m. UTC | #1
On Tuesday 05 April 2011 03:28 PM, shubhrajyoti@ti.com wrote:
> From: Shubhrajyoti D<a0393217@india.ti.com>
>
>
> Signed-off-by: Shubhrajyoti D<a0393217@india.ti.com>
Axel's patch added changes to prevent NULL access if pdata is NULL 
adding a check for keymap_data.
> ---
>   drivers/input/keyboard/twl4030_keypad.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
> index 09bef79..cc06c4b 100644
> --- a/drivers/input/keyboard/twl4030_keypad.c
> +++ b/drivers/input/keyboard/twl4030_keypad.c
> @@ -338,7 +338,7 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
>   	u8 reg;
>   	int error;
>
> -	if (!pdata || !pdata->rows || !pdata->cols ||
> +	if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data ||
>   	    pdata->rows>  TWL4030_MAX_ROWS || pdata->cols>  TWL4030_MAX_COLS) {
>   		dev_err(&pdev->dev, "Invalid platform_data\n");
>   		return -EINVAL;

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
axel lin April 6, 2011, 12:47 p.m. UTC | #2
2011/4/5 Shubhrajyoti <shubhrajyoti@ti.com>:
> On Tuesday 05 April 2011 03:28 PM, shubhrajyoti@ti.com wrote:
>>
>> From: Shubhrajyoti D<a0393217@india.ti.com>
>>
>>
>> Signed-off-by: Shubhrajyoti D<a0393217@india.ti.com>
>
> Axel's patch added changes to prevent NULL access if pdata is NULL adding a
> check for keymap_data.
>>

Acked-by: Axel Lin <axel.lin@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov April 6, 2011, 10:31 p.m. UTC | #3
On Wed, Apr 06, 2011 at 08:47:12PM +0800, Axel Lin wrote:
> 2011/4/5 Shubhrajyoti <shubhrajyoti@ti.com>:
> > On Tuesday 05 April 2011 03:28 PM, shubhrajyoti@ti.com wrote:
> >>
> >> From: Shubhrajyoti D<a0393217@india.ti.com>
> >>
> >>
> >> Signed-off-by: Shubhrajyoti D<a0393217@india.ti.com>
> >
> > Axel's patch added changes to prevent NULL access if pdata is NULL adding a
> > check for keymap_data.
> >>
> 
> Acked-by: Axel Lin <axel.lin@gmail.com>

Applied, thanks Shubhrajyoti.
diff mbox

Patch

diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 09bef79..cc06c4b 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -338,7 +338,7 @@  static int __devinit twl4030_kp_probe(struct platform_device *pdev)
 	u8 reg;
 	int error;
 
-	if (!pdata || !pdata->rows || !pdata->cols ||
+	if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data ||
 	    pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) {
 		dev_err(&pdev->dev, "Invalid platform_data\n");
 		return -EINVAL;