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:   Mon, 13 Jul 2020 11:14:24 +0530
From:   Suraj Upadhyay <usuraj35@...il.com>
To:     Benjamin Poirier <benjamin.poirier@...il.com>
Cc:     netdev@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] staging: qlge: Remove pci-dma-compat wrapper APIs.

On Mon, Jul 13, 2020 at 01:59:59PM +0900, Benjamin Poirier wrote:
> On 2020-07-11 18:16 +0530, Suraj Upadhyay wrote:
> > The legacy API wrappers in include/linux/pci-dma-compat.h
> > should go away as it creates unnecessary midlayering
> > for include/linux/dma-mapping.h APIs, instead use dma-mapping.h
> > APIs directly.
> > 
> > The patch has been generated with the coccinelle script below
> > and compile-tested.
> > 
> [...]
> > 
> > @@ expression E1, E2, E3, E4; @@
> > - pci_dma_sync_single_for_device(E1, E2, E3, E4)
> > + dma_sync_single_for_device(&E1->dev, E2, E3, (enum dma_data_direction)E4)
> 
> The qlge driver contains more usages of the deprecated pci_dma_* api
> than what this diff addresses. In particular, there are some calls to
> pci_dma_sync_single_for_cpu() which were not changed despite this
> expression being in the semantic patch.

Hii Ben,
        I couldn't find any instances of pci_dma_sync_single_for_cpu in
the drivers/staging/qlge/ driver, I ran a simple `git grep pci_dma_sync_single_for_cpu/device`
and got nothing.
If I am wrong, please send the line number of the usages.

> Dunno what happened but it should be reviewed. After converting away
> from all of the old api, the TODO file should also be updated.

Thanks for reminding me this, I would send a follow up patch to remove
"pci_dma_*" from "avoid legacy/deprecated apis (ex. replace pci_dma_*, replace pci_enable_msi,
  use pci_iomap)".


Thanks and Cheers,

Suraj Upadhyay.
> [...]
> 
> > 
> > diff --git a/drivers/staging/qlge/qlge_mpi.c b/drivers/staging/qlge/qlge_mpi.c
> > index fa178fc642a6..16a9bf818346 100644
> > --- a/drivers/staging/qlge/qlge_mpi.c
> > +++ b/drivers/staging/qlge/qlge_mpi.c
> > @@ -788,8 +788,9 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf,
> >  	char *my_buf;
> >  	dma_addr_t buf_dma;
> >  
> > -	my_buf = pci_alloc_consistent(qdev->pdev, word_count * sizeof(u32),
> > -				      &buf_dma);
> > +	my_buf = dma_alloc_coherent(&qdev->pdev->dev,
> > +				    word_count * sizeof(u32), &buf_dma,
> > +				    GFP_ATOMIC);
> >  	if (!my_buf)
> >  		return -EIO;
> >  
> > @@ -797,8 +798,8 @@ int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf,
> >  	if (!status)
> >  		memcpy(buf, my_buf, word_count * sizeof(u32));
> >  
> > -	pci_free_consistent(qdev->pdev, word_count * sizeof(u32), my_buf,
> > -			    buf_dma);
> > +	dma_free_coherent(&qdev->pdev->dev, word_count * sizeof(u32), my_buf,
> > +			  buf_dma);
> >  	return status;
> >  }
> >  
> > -- 
> > 2.17.1
> > 
> 
> 



Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ