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: <20210312200314.GF3014244@iweiny-DESK2.sc.intel.com>
Date:   Fri, 12 Mar 2021 12:03:14 -0800
From:   Ira Weiny <ira.weiny@...el.com>
To:     dsterba@...e.cz, Chris Mason <clm@...com>,
        Josef Bacik <josef@...icpanda.com>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/4] fs/btrfs: Convert kmap to kmap_local_page() using
 coccinelle

On Fri, Mar 12, 2021 at 07:58:39PM +0100, David Sterba wrote:
> On Tue, Feb 16, 2021 at 06:48:23PM -0800, ira.weiny@...el.com wrote:
> > --- a/fs/btrfs/lzo.c
> > +++ b/fs/btrfs/lzo.c
> > @@ -118,7 +118,7 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
> >  	struct workspace *workspace = list_entry(ws, struct workspace, list);
> >  	int ret = 0;
> >  	char *data_in;
> > -	char *cpage_out;
> > +	char *cpage_out, *sizes_ptr;
> >  	int nr_pages = 0;
> >  	struct page *in_page = NULL;
> >  	struct page *out_page = NULL;
> > @@ -258,10 +258,9 @@ int lzo_compress_pages(struct list_head *ws, struct address_space *mapping,
> >  	}
> >  
> >  	/* store the size of all chunks of compressed data */
> > -	cpage_out = kmap(pages[0]);
> > -	write_compress_length(cpage_out, tot_out);
> > -
> > -	kunmap(pages[0]);
> > +	sizes_ptr = kmap_local_page(pages[0]);
> > +	write_compress_length(sizes_ptr, tot_out);
> > +	kunmap_local(sizes_ptr);
> 
> Why is not cpage_out reused for this mapping? I don't see any reason for
> another temporary variable, cpage_out is not used at this point.

For this patch that is true.  However, I'm trying to convert the other kmaps as
well.  To do that I'll need cpage_out preserved for the final kunmap_local().

Unfortunately, the required nesting ordering of kmap_local_page() makes
converting the other calls hacky at best.  I'm not sure what to do about them.
The best I've come up with is doing a hacky extra unmap/remap to preserve the
nesting.

Anyway, I'd prefer to leave this additional temp variable but I can certainly
change if it you want.  The other conversions may never work/land.  :-/

Ira

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ