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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRJAJZTMOXfgIfZw@infradead.org>
Date:   Tue, 10 Aug 2021 11:00:21 +0200
From:   Christoph Hellwig <hch@...radead.org>
To:     Alex Williamson <alex.williamson@...hat.com>
Cc:     Jason Gunthorpe <jgg@...dia.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, peterx@...hat.com
Subject: Re: [PATCH 4/7] vfio,vfio-pci: Add vma to pfn callback

>  static int vfio_pci_reflck_attach(struct vfio_pci_device *vdev);
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 1e4fc69fee7d..42ca93be152a 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -875,6 +875,22 @@ struct vfio_device *vfio_device_get_from_dev(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(vfio_device_get_from_dev);
>  
> +static const struct file_operations vfio_device_fops;

If we ned a forward declaration here it would be nice to keep it at the top
of the file.  Finding a way to not need it would be even better.

> +
> +int vfio_device_vma_to_pfn(struct vfio_device *device,
> +			   struct vm_area_struct *vma, unsigned long *pfn)
> +{
> +	if (WARN_ON(!vma->vm_file || vma->vm_file->f_op != &vfio_device_fops ||
> +		    vma->vm_file->private_data != device))
> +		return -EINVAL;

WARN_ON_ONCE?

> +
> +	if (unlikely(!device->ops->vma_to_pfn))
> +		return -EPERM;
> +
> +	return device->ops->vma_to_pfn(device, vma, pfn);
> +}
> +EXPORT_SYMBOL_GPL(vfio_device_vma_to_pfn);

This function is only used in vfio.c, so it can be marked static instead of
being exported.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ