lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 25 Jul 2014 02:02:07 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Sachin Kamat <spk.linux@...il.com>
cc:	pramod.gurav.etc@...il.com, linux-input@...r.kernel.org,
	open list <linux-kernel@...r.kernel.org>,
	Pramod Gurav <pramod.gurav@...rtplayin.com>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Lejun Zhu <lejun.zhu@...ux.intel.com>,
	Sachin Kamat <sachin.kamat@...aro.org>
Subject: Re: [PATCH] Input: soc_button_array: Remove kfree on data allocated
 with devm_zalloc

On Fri, 25 Jul 2014, Sachin Kamat wrote:

> On Fri, Jul 25, 2014 at 12:39 PM,  <pramod.gurav.etc@...il.com> wrote:
> > From: Pramod Gurav <pramod.gurav@...rtplayin.com>
> >
> > This patch does below:
> > - Removes kfree done on data allocated with devm_zalloc in probe
> >   path of the driver.
> > - Adds a check on return value from devm_kzalloc which was missing
> >   and renames a lable from err_free_mem to err_mem.
> > - Adds couple of dev_err on failure to allocate memory
> >
> > CC: Dmitry Torokhov <dmitry.torokhov@...il.com>
> > CC: Lejun Zhu <lejun.zhu@...ux.intel.com>
> > CC: Sachin Kamat <sachin.kamat@...aro.org>
> >
> > Signed-off-by: Pramod Gurav <pramod.gurav@...rtplayin.com>
> > ---
> >  drivers/input/misc/soc_button_array.c |   19 ++++++++++++++-----
> >  1 file changed, 14 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
> > index 5a6334b..ac82971 100644
> > --- a/drivers/input/misc/soc_button_array.c
> > +++ b/drivers/input/misc/soc_button_array.c
> > @@ -83,6 +83,13 @@ soc_button_device_create(struct pnp_dev *pdev,
> >                                        sizeof(*gpio_keys_pdata) +
> >                                         sizeof(*gpio_keys) * MAX_NBUTTONS,
> >                                        GFP_KERNEL);
> > +       if (!gpio_keys_pdata) {
> > +               dev_err(&pdev->dev,
> > +                       "Can't allocate memory for gpio_keys_platform_data\n");
> 
> OOM message is not needed as memory subsystem will take care of it.
> 

In the worst case, the memory subsystem will print that a process was 
killed for this allocation to succeed so it's never actually going to 
fail.  However, it is indeed frowed upon to print your own oom message so 
you're right that it should be removed.

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

Powered by blists - more mailing lists