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: <YkHeTCGdnGPjW0/9@iweiny-desk3>
Date:   Mon, 28 Mar 2022 09:11:56 -0700
From:   Ira Weiny <ira.weiny@...el.com>
To:     "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Benjamin Philip <benjamin.philip495@...il.com>,
        Bart Van Assche <bvanassche@....org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Charlie Sands <sandsch@...thvilleschools.net>,
        Mitali Borkar <mitaliborkar810@...il.com>,
        Colin Ian King <colin.king@...el.com>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
        iweiny@...il.com, ira.weiny@...el.com
Subject: Re: [PATCH] staging: rts5208: Convert kmap() to kmap_local_page()

On Mon, Mar 28, 2022 at 08:41:53AM -0700, Ira Weiny wrote:
> On Mon, Mar 28, 2022 at 01:24:40PM +0200, Fabio M. De Francesco wrote:
> > The use of kmap() is being deprecated and kmap_local_page() is faster.
> > Use kmap_local_page() in place of kmap().
> 
> Thanks for the patch!  I have just a couple of comments.
> 
> kmap_local_page() is not necessarily faster than kmap() but it is more correct
> in this case.  You should mention why.
> 
> Also to help with kmap_local_page() there are a number of helpers implemented
> in highmem.h for things like memcpy, memmove, etc.
> 
> Check out memcpy_page() for this use case.
> 
> Thank you!
> Ira
> 

Also I believe this is work toward the Outreachy program.  If so be sure to
follow the guidelines on this page:

https://kernelnewbies.org/Outreachyfirstpatch

In particular, it does not look like you cc'ed the Outreachy list.

Thanks!
Ira

> > 
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
> > ---
> >  drivers/staging/rts5208/rtsx_transport.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
> > index 805dc18fac0a..de690d7ee5e3 100644
> > --- a/drivers/staging/rts5208/rtsx_transport.c
> > +++ b/drivers/staging/rts5208/rtsx_transport.c
> > @@ -92,13 +92,13 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
> >  			while (sglen > 0) {
> >  				unsigned int plen = min(sglen, (unsigned int)
> >  						PAGE_SIZE - poff);
> > -				unsigned char *ptr = kmap(page);
> > +				unsigned char *ptr = kmap_local_page(page);
> >  
> >  				if (dir == TO_XFER_BUF)
> >  					memcpy(ptr + poff, buffer + cnt, plen);
> >  				else
> >  					memcpy(buffer + cnt, ptr + poff, plen);
> > -				kunmap(page);
> > +				kunmap_local(ptr);
> >  
> >  				/* Start at the beginning of the next page */
> >  				poff = 0;
> > -- 
> > 2.34.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ