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: <alpine.DEB.2.00.1204231334200.11602@chino.kir.corp.google.com>
Date:	Mon, 23 Apr 2012 13:35:30 -0700 (PDT)
From:	David Rientjes <rientjes@...gle.com>
To:	Sasikantha babu <sasikanth.v19@...il.com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mel@....ul.ie>, Christoph Lameter <cl@...ux.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm:vmstat - Removed debug fs entries on failure of file
 creation and made extfrag_debug_root dentry local

On Tue, 24 Apr 2012, Sasikantha babu wrote:

> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f600557..ddae476 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1220,7 +1220,6 @@ module_init(setup_vmstat)
>  #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_COMPACTION)
>  #include <linux/debugfs.h>
>  
> -static struct dentry *extfrag_debug_root;
>  
>  /*
>   * Return an index indicating how much of the available free memory is
> @@ -1358,17 +1357,23 @@ static const struct file_operations extfrag_file_ops = {
>  
>  static int __init extfrag_debug_init(void)
>  {
> +	struct dentry *extfrag_debug_root;
> +
>  	extfrag_debug_root = debugfs_create_dir("extfrag", NULL);
>  	if (!extfrag_debug_root)
>  		return -ENOMEM;
>  
>  	if (!debugfs_create_file("unusable_index", 0444,
> -			extfrag_debug_root, NULL, &unusable_file_ops))
> +			extfrag_debug_root, NULL, &unusable_file_ops)) {
> +		debugfs_remove (extfrag_debug_root);
>  		return -ENOMEM;
> +	}
>  
>  	if (!debugfs_create_file("extfrag_index", 0444,
> -			extfrag_debug_root, NULL, &extfrag_file_ops))
> +			extfrag_debug_root, NULL, &extfrag_file_ops)) {
> +		debugfs_remove_recursive (extfrag_debug_root);
>  		return -ENOMEM;
> +	}
>  
>  	return 0;
>  }

Probably easier to do something like "goto fail" and then have a

		return 0;

	fail:
		debugfs_remove_recursive(extfrag_debug_root);
		return -ENOMEM;

at the end of the function.

Please run scripts/checkpatch.pl on your patch before proposing it.
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ