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]
Message-ID: <ZLffIfEKz/nR9Jj/@bobcopeland.com>
Date:   Wed, 19 Jul 2023 09:03:29 -0400
From:   Bob Copeland <me@...copeland.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-karma-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] fs: omfs: Use flexible-array member in struct
 omfs_extent

On Mon, Jul 17, 2023 at 08:20:22AM -0700, Kees Cook wrote:
> > @@ -14,7 +14,7 @@ static u32 omfs_max_extents(struct omfs_sb_info *sbi, int offset)
> >  {
> >  	return (sbi->s_sys_blocksize - offset -
> >  		sizeof(struct omfs_extent)) /
> > -		sizeof(struct omfs_extent_entry) + 1;
> > +		sizeof(struct omfs_extent_entry);
> >  }
> 
> I think the original calculation meant to do:
> 
>   	return (sbi->s_sys_blocksize - offset -
>   		(sizeof(struct omfs_extent) - sizeof(struct omfs_extent_entry))) /
> 		sizeof(struct omfs_extent_entry);

I can confirm the intent.  I also went back and looked at the usages just
to be sure.

In this case, there are two possible values for x = s_sys_blocksize - offset:
7728 or 8128, and both can be divided by 16 evenly so you have either:

    f_old = (x - 32) / 16 + 1 or:
    f_new = (x - 16) / 16

they both simplify to x/16 - 1 so they are equivalent for these inputs.

-- 
Bob Copeland %% https://bobcopeland.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ