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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMHSBOX8pTyJ+TcSwpfwVtpQcJ0HmHeccONJq0ZmL-Lh4+8z2g@mail.gmail.com>
Date:	Thu, 11 Feb 2016 10:49:07 -0800
From:	Gwendal Grignou <gwendal@...omium.org>
To:	Tomeu Vizoso <tomeu.vizoso@...labora.com>
Cc:	Gwendal Grignou <gwendal@...omium.org>,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	Sameer Nanda <snanda@...omium.org>,
	Benson Leung <bleung@...omium.org>,
	Enric Balletbò <enric.balletbo@...labora.co.uk>,
	Vic Yang <victoryang@...omium.org>,
	Vincent Palatin <vpalatin@...omium.org>,
	Randall Spangler <rspangler@...omium.org>,
	Vic Yang <victoryang@...gle.com>,
	Olof Johansson <olof@...om.net>, linux-input@...r.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Lee Jones <lee.jones@...aro.org>
Subject: Re: [PATCH v1 2/6] mfd: cros_ec: Add MKBP event support

On Thu, Feb 11, 2016 at 6:52 AM, Tomeu Vizoso
<tomeu.vizoso@...labora.com> wrote:
>
> On 02/05/2016 06:24 PM, Gwendal Grignou wrote:
> > We should not used kmalloc when get events, these functions are called
> > quite often.
> > Gwendal.
> >
> > On Fri, Feb 5, 2016 at 5:32 AM, Tomeu Vizoso <tomeu.vizoso@...labora.com
> > <mailto:tomeu.vizoso@...labora.com>> wrote:
> >
> >     +static int cros_ec_get_host_command_version_mask(struct
> >     cros_ec_device *ec_dev,
> >     +       u16 cmd, u32 *mask)
> >     +{
> >     +       struct ec_params_get_cmd_versions *pver;
> >     +       struct ec_response_get_cmd_versions *rver;
> >     +       struct cros_ec_command *msg;
> >     +       int ret;
> >     +
> >     +       msg = kmalloc(sizeof(*msg) + max(sizeof(rver), sizeof(pver)),
> >     +                     GFP_KERNEL);
> >     +       if (!msg)
> >     +               return -ENOMEM;
> >
> >  Victor's version in https://chromium-review.googlesource.com/272954
> > looks cleaner: no malloc, no need to cast rver.
>
> I agree that it looks cleaner, but how would you allocate the payload at
> build time if it has to be max(sizeof(*pver), sizeof(*rver))?
For this one, given cros_ec_get_host_command_version_mask() is called
once, a kmalloc is fine.

Gwendal.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ