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-next>] [day] [month] [year] [list]
Message-ID: <0d0817a2c6a8467e83b07c91f50511fa@inspur.com>
Date:   Tue, 27 Sep 2022 01:21:50 +0000
From:   tomorrow Wang (王德明) 
        <wangdeming@...pur.com>
To:     "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "jgg@...dia.com" <jgg@...dia.com>
CC:     "pbonzini@...hat.com" <pbonzini@...hat.com>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfio: Use filp instead of fd

Hi

Why kvm_vfio_group_add use file.
  
  struct file *filp;
  .....
  filp = fget(fd);

  .....
  kvg->file = filp;
  ......
  fput(filp);

> from: Al Viro <viro@....linux.org.uk> 代表 Al Viro
> time: 2022-9-22 3:38
> to: Jason Gunthorpe <jgg@...dia.com>
> pbonzini@...hat.com; kvm@...r.kernel.org; linux-kernel@...r.kernel.org
> sub: Re: [PATCH] vfio: Use filp instead of fd
> 
> On Mon, Sep 26, 2022 at 02:07:43PM -0300, Jason Gunthorpe wrote:
> > On Mon, Sep 26, 2022 at 02:54:07AM -0400, Deming Wang wrote:
> > > The function of kvm_vfio_group_set_spapr_tce and kvm_vfio_group_del
> > > use fd indirectly.But,it only be used for fd.file. So,we can
> > > directly use the struct of file instead.
> > >
> > > Signed-off-by: Deming Wang <wangdeming@...pur.com>
> > > ---
> > >  virt/kvm/vfio.c | 24 ++++++++++++------------
> > >  1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > I thought about changing this too when I was looking at this.
> > fdget/fdput includes a tiny micro-optimization that is legal here,
> > however I doubt anyone cares about performance on this path.
> 
> Microoptimization or not, I'd rather keep fget() limited to cases where we
> really need it.  There are non-trivial cases and having them easy to find
is a
> good thing.
> 
> Again, the preferred way to do descriptor lookups is fdget() family, not
fget()
> one.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (3780 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ