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:   Tue, 5 Oct 2021 17:41:08 +0800
From:   Qu Wenruo <wqu@...e.com>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>,
        Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>
Cc:     linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        noreply@...erman.id.au
Subject: Re: [PATCH -next] btrfs: lzo: Mask instead of divide to fix 32-bit
 build



On 2021/10/5 17:34, Geert Uytterhoeven wrote:
> On 32-bit builds (e.g. m68k):
> 
>      ERROR: modpost: "__umoddi3" [fs/btrfs/btrfs.ko] undefined!
> 
> "cur_in - start" is 64-bit, while sectorsize is u32.
> 
> As sectorsize is always a power of two, the 64-by-32 modulo operation
> can be replaced by a much cheaper bitwise AND with "sectorsize - 1".
> 
> Fixes: 0078783c7089fc83 ("btrfs: rework lzo_compress_pages() to make it subpage compatible")
> Reported-by: noreply@...erman.id.au
> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>

Oh, thanks for catching this.

Reviewed-by: Qu Wenruo <wqu@...e.com>

Thanks,
Qu
> ---
> Compile-tested only.
> ---
>   fs/btrfs/lzo.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
> index 47003cec4046f13e..d08f9eba49dab3cd 100644
> --- a/fs/btrfs/lzo.c
> +++ b/fs/btrfs/lzo.c
> @@ -211,7 +211,7 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
>   	 */
>   	cur_out += LZO_LEN;
>   	while (cur_in < start + len) {
> -		u32 sector_off = (cur_in - start) % sectorsize;
> +		u32 sector_off = (cur_in - start) & (sectorsize - 1);
>   		u32 in_len;
>   		size_t out_len;
>   
> 

Powered by blists - more mailing lists