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: <alpine.LRH.2.00.1008111505420.2372@twin.jikos.cz>
Date:	Wed, 11 Aug 2010 15:06:36 +0200 (CEST)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Davidlohr Bueso <dave@....org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] jbd: Remove redundant NULL check upon kfree()

On Wed, 11 Aug 2010, Davidlohr Bueso wrote:

> jbd: Remove redundant NULL check upon kfree().
> 
> Signed-off-by: Davidlohr Bueso <dave@....org>
> ---
>  fs/jbd/transaction.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
> index 5ae71e7..5e98130 100644
> --- a/fs/jbd/transaction.c
> +++ b/fs/jbd/transaction.c
> @@ -232,8 +232,7 @@ repeat_locked:
>  
>  	lock_map_acquire(&handle->h_lockdep_map);
>  out:
> -	if (unlikely(new_transaction))		/* It's usually NULL */
> -		kfree(new_transaction);
> +	kfree(new_transaction);

This doesn't seem entirely redundant, as it is optimized (via the 
unlikely() hint) for the opposite case than what kfree() is optimized for 
(kfree() assumes that the pointer is likely non-NULL, while the code above 
assumes that the pointer si likely NULL).

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

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