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:   Tue, 26 Oct 2021 20:46:19 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Alex Williamson <alex.williamson@...hat.com>
Cc:     Yishai Hadas <yishaih@...dia.com>, bhelgaas@...gle.com,
        saeedm@...dia.com, linux-pci@...r.kernel.org, kvm@...r.kernel.org,
        netdev@...r.kernel.org, kuba@...nel.org, leonro@...dia.com,
        kwankhede@...dia.com, mgurtovoy@...dia.com, maorg@...dia.com
Subject: Re: [PATCH V4 mlx5-next 11/13] vfio/mlx5: Implement vfio_pci driver
 for mlx5 devices

On Tue, Oct 26, 2021 at 04:42:28PM -0600, Alex Williamson wrote:

> > +	/* Saving switches on and not running */
> > +	if ((flipped_bits &
> > +	     (VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING)) &&
> > +	    ((state & (VFIO_DEVICE_STATE_RUNNING |
> > +	      VFIO_DEVICE_STATE_SAVING)) == VFIO_DEVICE_STATE_SAVING)) {
> 
> Can't this be reduced to:
> 
>  if ((flipped_bits & ~VFIO_DEVICE_STATE_RESUMING) &&
>      (state == VFIO_DEVICE_STATE_SAVING)) {
>
> Maybe there's an argument for the original to be more invariant of TBD
> device_state bits?  

I definitely prefer to see it explicit for this reason.

The shorter version relies on too much implicit stuff - eg that
SAVING|RESUMING is rejected at the top and seeing RESUMING as part of
a stanza that is only about SAVING|RUNNING is less reasable.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ