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: <20160913064713.GB4047@osiris>
Date:   Tue, 13 Sep 2016 08:47:13 +0200
From:   Heiko Carstens <heiko.carstens@...ibm.com>
To:     Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc:     linux-s390@...r.kernel.org,
        Michael Holzheu <holzheu@...ux.vnet.ibm.com>,
        linux-kernel@...r.kernel.org,
        Alexander Kuleshov <kuleshovmail@...il.com>,
        Martin Schwidefsky <schwidefsky@...ibm.com>
Subject: Re: [PATCH] s390: cleanup with list_first_entry_or_null()

On Tue, Sep 13, 2016 at 03:10:39AM +0900, Masahiro Yamada wrote:
> The combo of list_empty() check and return list_first_entry()
> can be replaced with list_first_entry_or_null().
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
> ---
> 
>  arch/s390/kernel/crash_dump.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
> index 29df848..621907d 100644
> --- a/arch/s390/kernel/crash_dump.c
> +++ b/arch/s390/kernel/crash_dump.c
> @@ -71,9 +71,8 @@ struct save_area * __init save_area_alloc(bool is_boot_cpu)
>   */
>  struct save_area * __init save_area_boot_cpu(void)
>  {
> -	if (list_empty(&dump_save_areas))
> -		return NULL;
> -	return list_first_entry(&dump_save_areas, struct save_area, list);
> +	return list_first_entry_or_null(&dump_save_areas, struct save_area,
> +					list);

Applied, however without the line break in order to improve readability.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ