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: <Pine.LNX.4.44L0.1702212036090.16103-100000@netrider.rowland.org>
Date:   Tue, 21 Feb 2017 20:40:53 -0500 (EST)
From:   Alan Stern <stern@...land.harvard.edu>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Felipe Balbi <felipe.balbi@...ux.intel.com>,
        Peter Chen <peter.chen@....com>,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        Mathias Nyman <mathias.nyman@...ux.intel.com>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Peter Senna Tschudin <peter.senna@...il.com>
Subject: Re: [PATCH] usb: misc: add a missing continue and refactor code

On Tue, 21 Feb 2017, Gustavo A. R. Silva wrote:

> Code refactoring to make the flow easier to follow and add missing
> 'continue' for case USB_ENDPOINT_XFER_INT.
> 
> Addresses-Coverity-ID: 1248733
> Cc: Alan Stern <stern@...land.harvard.edu>
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
> ---
>  drivers/usb/misc/usbtest.c | 50 +++++++++++++++++++++++++++-------------------
>  1 file changed, 30 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
> index 3525626..8723e33 100644
> --- a/drivers/usb/misc/usbtest.c
> +++ b/drivers/usb/misc/usbtest.c
> @@ -124,6 +124,32 @@ static struct usb_device *testdev_to_usbdev(struct usbtest_dev *test)
>  
>  /*-------------------------------------------------------------------------*/
>  
> +static inline void try_intr(struct usb_host_endpoint *e,
> +			    struct usb_host_endpoint *int_in,
> +			    struct usb_host_endpoint *int_out)
> +{
> +	if (usb_endpoint_dir_in(&e->desc)) {
> +		if (!int_in)
> +			int_in = e;
> +	} else {
> +		if (!int_out)
> +			int_out = e;
> +	}
> +}
> +
> +static inline void try_iso(struct usb_host_endpoint *e,
> +			   struct usb_host_endpoint *iso_in,
> +			   struct usb_host_endpoint *iso_out)
> +{
> +	if (usb_endpoint_dir_in(&e->desc)) {
> +		if (!iso_in)
> +			iso_in = e;
> +	} else {
> +		if (!iso_out)
> +			iso_out = e;
> +	}
> +}
> +

This is not at all what I had in mind.  First, it's incorrect (can you 
see why?).  Second, by "inline" I meant moving the code to be actually 
in-line next to the conditional, not some place else in a separate 
subroutine (even if the subroutine is declared inline).

Also, the code for the USB_ENDPOINT_XFER_BULK case should look like the 
other two.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ