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:	Wed, 13 Feb 2013 15:53:25 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Tim Gardner <tim.gardner@...onical.com>
Cc:	linux-kernel@...r.kernel.org, Mark Fasheh <mfasheh@...e.com>,
	Joel Becker <jlbec@...lplan.org>,
	Akinobu Mita <akinobu.mita@...il.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>, Tejun Heo <tj@...nel.org>,
	Jiri Kosina <jkosina@...e.cz>, ocfs2-devel@....oracle.com
Subject: Re: [PATCH linux-next v2] ocfs2: remove kfree() redundant null
 checks

On Wed, 13 Feb 2013 13:29:45 -0700
Tim Gardner <tim.gardner@...onical.com> wrote:

> smatch analysis indicates a number of redundant NULL checks before
> calling kfree(), e.g.,
> 
> fs/ocfs2/alloc.c:6138 ocfs2_begin_truncate_log_recovery() info:
>  redundant null check on *tl_copy calling kfree()
> 
> fs/ocfs2/alloc.c:6755 ocfs2_zero_range_for_truncate() info:
>  redundant null check on pages calling kfree()
> 
> ...
>
> diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
> index 31b9463..83a1a1d 100644
> --- a/fs/ocfs2/alloc.c
> +++ b/fs/ocfs2/alloc.c
> @@ -6134,7 +6134,7 @@ bail:
>  		iput(tl_inode);
>  	brelse(tl_bh);
>  
> -	if (status < 0 && (*tl_copy)) {
> +	if (status < 0) {
>  		kfree(*tl_copy);
>  		*tl_copy = NULL;
>  		mlog_errno(status);

This change does other things.  For example, if
ocfs2_begin_truncate_log_recovery()'s first "goto bail" is taken, we
will now call mlog_errno(status) twice.

That function is pretty confused about its error recovery and logging.
it needs some maintenance.  I'll omit this hunk of your patch.


> @@ -534,7 +533,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
>  		mlog_errno(status);
>  
>  bail:
> -	if ((status < 0) && (*alloc_copy)) {
> +	if (status < 0) {
>  		kfree(*alloc_copy);
>  		*alloc_copy = NULL;
>  	}

Similar, but this change lokos OK.


--
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