* [PATCH] Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe()
@ 2011-04-01 15:08 Axel Lin
2011-04-01 15:18 ` Felipe Balbi
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-04-01 15:08 UTC (permalink / raw)
To: linux-kernel; +Cc: David Brownell, Dmitry Torokhov, linux-input
We should first check whether platform data is NULL or not, before
dereferencing it to get the keymap.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/input/keyboard/twl4030_keypad.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 09bef79..d02811c 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -332,7 +332,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp)
static int __devinit twl4030_kp_probe(struct platform_device *pdev)
{
struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
- const struct matrix_keymap_data *keymap_data = pdata->keymap_data;
+ const struct matrix_keymap_data *keymap_data;
struct twl4030_keypad *kp;
struct input_dev *input;
u8 reg;
@@ -344,6 +344,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
return -EINVAL;
}
+ keymap_data = pdata->keymap_data;
+
kp = kzalloc(sizeof(*kp), GFP_KERNEL);
input = input_allocate_device();
if (!kp || !input) {
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe()
2011-04-01 15:08 [PATCH] Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe() Axel Lin
@ 2011-04-01 15:18 ` Felipe Balbi
0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2011-04-01 15:18 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, David Brownell, Dmitry Torokhov, linux-input
On Fri, Apr 01, 2011 at 11:08:03PM +0800, Axel Lin wrote:
> We should first check whether platform data is NULL or not, before
> dereferencing it to get the keymap.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
--
balbi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-01 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 15:08 [PATCH] Input: twl4030_keypad - fix potential NULL dereference in twl4030_kp_probe() Axel Lin
2011-04-01 15:18 ` Felipe Balbi
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.