[PATCH 1/2] input: keypad: tc3589x: localize platform data

Linus Walleij linus.walleij at linaro.org
Tue Apr 7 06:07:32 PDT 2015


On Fri, Mar 27, 2015 at 5:47 PM, Dmitry Torokhov
<dmitry.torokhov at 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



More information about the linux-arm-kernel mailing list