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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2017 11:17:15 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     "Luis R. Rodriguez" <mcgrof@...nel.org>
Cc:     akpm@...ux-foundation.org, keescook@...omium.org,
        mfuzzey@...keon.com, zohar@...ux.vnet.ibm.com, dhowells@...hat.com,
        pali.rohar@...il.com, tiwai@...e.de, arend.vanspriel@...adcom.com,
        zajec5@...il.com, nbroeking@...com, markivx@...eaurora.org,
        stephen.boyd@...aro.org, broonie@...nel.org,
        dmitry.torokhov@...il.com, dwmw2@...radead.org,
        torvalds@...ux-foundation.org, Abhay_Salunke@...l.com,
        bjorn.andersson@...aro.org, jewalt@...innovations.com,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v2 10/23] firmware: add helper to copy built-in data to
 pre-alloc buffer

On Mon, Nov 20, 2017 at 10:23:56AM -0800, Luis R. Rodriguez wrote:
> This makes it clearer that the parameters passed are only used for
> the preallocated buffer option, ie, when a caller uses:
> 
> 	request_firmware_into_buf()
> 
> Otherwise this code won't run. We flip the logic just so the actual
> prellocated buf code is not indented.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@...nel.org>
> ---
>  drivers/base/firmware_class.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 4f64410fe7e6..aba3f2cbe2f4 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -146,6 +146,14 @@ static struct firmware_cache fw_cache;
>  extern struct builtin_fw __start_builtin_fw[];
>  extern struct builtin_fw __end_builtin_fw[];
>  
> +static void fw_copy_to_prealloc_buf(struct firmware *fw,
> +				    void *buf, size_t size)
> +{
> +	if (!buf || size < fw->size)
> +		return;

Shouldn't this return an error?

> +	memcpy(buf, fw->data, fw->size);

I'll take this, but it feels really odd...

Powered by blists - more mailing lists