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]
Date:   Thu, 21 Apr 2022 13:46:15 +0200
From:   Jan Kara <jack@...e.cz>
To:     Jinke Han <hanjinke.666@...edance.com>
Cc:     tytso@....edu, adilger.kernel@...ger.ca,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext4: remove unnecessary code in __mb_check_buddy

On Mon 04-04-22 23:22:43, Jinke Han wrote:
> From: Jinke Han <hanjinke.666@...edance.com>
> 
> When enter elseif branch, the the MB_CHECK_ASSERT will never fail.
> In addtion, the only illegal combination is 0/0, which can be caught
> by the first if branch.
> 
> Signed-off-by: Jinke Han <hanjinke.666@...edance.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>
	
Ted, this seems to have fallen through the cracks...

								Honza

> ---
>  fs/ext4/mballoc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index e5d43d2ee474..eba650b31870 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -576,13 +576,10 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
>  		for (i = 0; i < max; i++) {
>  
>  			if (mb_test_bit(i, buddy)) {
> -				/* only single bit in buddy2 may be 1 */
> +				/* only single bit in buddy2 may be 0 */
>  				if (!mb_test_bit(i << 1, buddy2)) {
>  					MB_CHECK_ASSERT(
>  						mb_test_bit((i<<1)+1, buddy2));
> -				} else if (!mb_test_bit((i << 1) + 1, buddy2)) {
> -					MB_CHECK_ASSERT(
> -						mb_test_bit(i << 1, buddy2));
>  				}
>  				continue;
>  			}
> -- 
> 2.20.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ