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: <20171019134148.52b890b4@kitsune.suse.cz>
Date:   Thu, 19 Oct 2017 13:41:48 +0200
From:   Michal Suchánek <msuchanek@...e.de>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc:     linuxppc-dev@...ts.ozlabs.org,
        Alex Williamson <alex.williamson@...hat.com>,
        Alexey Kardashevskiy <aik@...abs.ru>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Bart Van Assche <bart.vanassche@...disk.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        David Gibson <david@...son.dropbear.id.au>,
        Doug Ledford <dledford@...hat.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Johan Hovold <johan@...nel.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Nathan Fontenot <nfont@...ux.vnet.ibm.com>,
        Paul Mackerras <paulus@...ba.org>,
        Rob Herring <robh@...nel.org>,
        Sahil Mehta <sahilmehta17@...il.com>,
        Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
        kernel-janitors@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/5] powerpc-pseries: Return directly after a failed
 kzalloc_node() in iommu_pseries_alloc_group()

Hello,

On Wed, 18 Oct 2017 21:26:10 +0200
SF Markus Elfring <elfring@...rs.sourceforge.net> wrote:

> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Wed, 18 Oct 2017 20:15:32 +0200
> 
> Return directly after a call of the function "kzalloc_node" failed
> at the beginning.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  arch/powerpc/platforms/pseries/iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/iommu.c
> b/arch/powerpc/platforms/pseries/iommu.c index
> b6c12b8e3ace..207ff8351af1 100644 ---
> a/arch/powerpc/platforms/pseries/iommu.c +++
> b/arch/powerpc/platforms/pseries/iommu.c @@ -61,7 +61,7 @@ static
> struct iommu_table_group *iommu_pseries_alloc_group(int node) 
>  	table_group = kzalloc_node(sizeof(*table_group), GFP_KERNEL,
> node); if (!table_group)
> -		goto fail_exit;
> +		return NULL;
>  
>  	tbl = kzalloc_node(sizeof(*tbl), GFP_KERNEL, node);
>  	if (!tbl)

I have seen quite a few fixes that do inverse of this patch after a
piece of code allocating some extra piece of memory was added before
code that just returns on fail because it is the first allocation in
the function.

This is not useful.

A final fail_exit that frees everything that could have been allocated
is much better. That applies to 5/5 as well.

Thanks

Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ