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] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516848563.8378.60.camel@perches.com>
Date:   Wed, 24 Jan 2018 18:49:23 -0800
From:   Joe Perches <joe@...ches.com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>, matt@...eblueprint.co.uk,
        ard.biesheuvel@...aro.org, tglx@...utronix.de, mingo@...hat.com,
        hpa@...or.com
Cc:     x86@...nel.org, linux-efi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: efi: Replace GFP_ATOMIC with GFP_KERNEL in
 efi_query_variable_store

On Thu, 2018-01-25 at 10:29 +0800, Jia-Ju Bai wrote:
> The function kzalloc here is not called in atomic context.
> If nonblocking in efi_query_variable_store is true, 
> namely it is in atomic context, efi_query_variable_store will return before
> this kzalloc is called.
> Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL.
> 
> This is found by a static analysis tool named DCNS written by myself.
[]
> diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
[]
> @@ -177,7 +177,7 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size,
>  		 * that by attempting to use more space than is available.
>  		 */
>  		unsigned long dummy_size = remaining_size + 1024;
> -		void *dummy = kzalloc(dummy_size, GFP_ATOMIC);
> +		void *dummy = kzalloc(dummy_size, GFP_KERNEL);

trivially, kzalloc takes a size_t not an unsigned long
and this _could_, though probably doesn't, lose precision.

It might be nicer to convert to size_t where appropriate.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ