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: <722d3830-cd03-47ba-8587-db3aff076278@kernel.org>
Date:   Tue, 30 Apr 2019 09:49:07 -0600
From:   shuah <shuah@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     David Laight <David.Laight@...lab.com>,
        Valentina Manea <valentina.manea.m@...il.com>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>, shuah <shuah@...nel.org>
Subject: Re: [PATCH] usbip: vhci_hcd: Mark expected switch fall-through

On 4/30/19 9:44 AM, Greg Kroah-Hartman wrote:
> On Mon, Apr 29, 2019 at 10:05:51AM -0500, Gustavo A. R. Silva wrote:
>>
>>
>> On 4/29/19 9:44 AM, David Laight wrote:
>>> From: Gustavo A. R. Silva
>>>> Sent: 29 April 2019 15:40
>>>> In preparation to enabling -Wimplicit-fallthrough, mark switch
>>>> cases where we are expecting to fall through.
>>> ...
>>>> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
>>>> index 667d9c0ec905..000ab7225717 100644
>>>> --- a/drivers/usb/usbip/vhci_hcd.c
>>>> +++ b/drivers/usb/usbip/vhci_hcd.c
>>>> @@ -508,6 +508,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
>>>>   		case USB_PORT_FEAT_U1_TIMEOUT:
>>>>   			usbip_dbg_vhci_rh(
>>>>   				" SetPortFeature: USB_PORT_FEAT_U1_TIMEOUT\n");
>>>> +			/* Fall through */
>>>>   		case USB_PORT_FEAT_U2_TIMEOUT:
>>>>   			usbip_dbg_vhci_rh(
>>>>   				" SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
>>>
>>> That doesn't look right, both debug messages seem to get printed.
>>>
>>
>> At first sight, I thought the same way, then I took a look into
>> commit:
>>
>> 1c9de5bf428612458427943b724bea51abde520a
>>
>> and noticed that the original developer properly added fall-through
>> comments in other places in the same switch() code, that gave me the
>> impression he knew what he was doing; then I noticed the following
>> error message in case USB_PORT_FEAT_U2_TIMEOUT:
>>
>> 	if (hcd->speed != HCD_USB3) {
>> 		pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
>> 		       "supported for USB 2.0 roothub\n");
>> 		goto error;
>> 	}
>>
>> this error message is what makes me think the fall-through is
>> intentional; otherwise I think it would look like this instead:
>>
>> 	if (hcd->speed != HCD_USB3) {
>> 		pr_err("USB_PORT_FEAT_U2_TIMEOUT req not "
>> 		       "supported for USB 2.0 roothub\n");
>> 		goto error;
>> 	}
> 
> I think you are right, that's horrid, but correct :(

Yes. This hub_control is poorly organized and could use cleanup.
> 
> Will go queue this up, thanks.
> 

Acked-by: Shuah Khan <skhan@...uxfoundation.org>

Thanks Greg!. It is on my list of things to Ack today.

-- Shuah

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ