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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 7 Jan 2010 17:05:37 -0800
From:	Paul Menage <menage@...gle.com>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	"Kirill A. Shutemov" <kirill@...temov.name>,
	containers@...ts.linux-foundation.org, linux-mm@...ck.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Pavel Emelyanov <xemul@...nvz.org>,
	Dan Malek <dan@...eddedalley.com>,
	Vladislav Buzov <vbuzov@...eddedalley.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
	Alexander Shishkin <virtuoso@...nd.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/4] cgroup: implement eventfd-based generic API for 
	notifications

On Thu, Jan 7, 2010 at 4:55 PM, Li Zefan <lizf@...fujitsu.com> wrote:
>
> Use multi labels is much better:

I disagree with that - in the absence of a language that can do proper
destructor-based cleanup (i.e. a strictly controlled subset of C++ :-)
) I think it's clearer to have a single failure path where you can
clean up anything that needs to be cleaned up, without excessive
dependencies on exactly when the failure occurred. Changes then become
less error-prone.

Paul

>
> label4::
>        fput(cfile);
> label3:
>        eventfd_ctx_put(event->eventfd);
> label2:
>        fput(efile);
> label1:
>        kfree(event);
>
> compared to:
>
> +fail:
> +       if (!IS_ERR(cfile))
> +               fput(cfile);
> +
> +       if (event && event->eventfd && !IS_ERR(event->eventfd))
> +               eventfd_ctx_put(event->eventfd);
> +
> +       if (!IS_ERR(efile))
> +               fput(efile);
> +
> +       kfree(event);
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists