lkml.org 
[lkml]   [2015]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] input: keypad: tc3589x: localize platform data
From
On Fri, Mar 27, 2015 at 5:47 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> Hmm, just noticed an issue:
>
>> >
>> > keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL);
>> > + keypad->board = tc3589x_keypad_of_probe(&pdev->dev);
>> > + if (IS_ERR(keypad->board)) {
>> > + dev_err(&pdev->dev, "invalid keypad platform data\n");
>> > + return PTR_ERR(keypad->board);
>> > + }
>> > +
>> > input = input_allocate_device();
>> > if (!keypad || !input) {
>> > dev_err(&pdev->dev, "failed to allocate keypad memory\n");
>
> You slid of prasing right in between memory allocation and checking if
> it succeeded, so there is a potential oops and memory leak now.
>
> I want to commit the version of the patch below, holler if you disagree.
> Note that I reverted much of plat -> board renames to keep the patch
> small.

Sorry. The new version looks fine. Reviewed-by.

Yours,
Linus Walleij


\
 
 \ /
  Last update: 2015-04-07 15:41    [W:0.061 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site