Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403055
| From | Andrey Ryabinin <ryabinin.a.a@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: UBSAN whinge in ihci-hub.c |
| Date | 2016-05-18 17:10 +0200 |
| Message-ID | <rAbgK-3KP-5@gated-at.bofh.it> (permalink) |
| References | <rA8LU-25R-37@gated-at.bofh.it> <rAaXn-3oK-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
2016-05-18 17:40 GMT+03:00 Alan Stern <stern@rowland.harvard.edu>:
> All right, I'm getting very tired of all these bug reports. Besides,
> Andrey has a point: Unless you're Linus, arguing against the C standard
> is futile. (Even though the language dialect used in the kernel is not
> standard C.)
>
> Does this patch make UBSAN happy? The runtime overhead is minimal.
>
It does. However, you could fool ubsan way more easy:
u32 __iomem *hostpc_reg = ehci->regs->hostpc +
(wIndex & 0xff) - 1;
> Alan Stern
>
>
>
> Index: usb-4.x/drivers/usb/host/ehci-hub.c
> ===================================================================
> --- usb-4.x.orig/drivers/usb/host/ehci-hub.c
> +++ usb-4.x/drivers/usb/host/ehci-hub.c
> @@ -872,14 +872,17 @@ int ehci_hub_control(
> ) {
> struct ehci_hcd *ehci = hcd_to_ehci (hcd);
> int ports = HCS_N_PORTS (ehci->hcs_params);
> - u32 __iomem *status_reg = &ehci->regs->port_status[
> - (wIndex & 0xff) - 1];
> - u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];
> + u32 __iomem *status_reg, *hostpc_reg;
> u32 temp, temp1, status;
> unsigned long flags;
> int retval = 0;
> unsigned selector;
>
> + temp = wIndex & 0xff;
> + temp -= (temp > 0);
> + status_reg = &ehci->regs->port_status[temp];
> + hostpc_reg = &ehci->regs->hostpc[temp];
> +
> /*
> * FIXME: support SetPortFeatures USB_PORT_FEAT_INDICATOR.
> * HCS_INDICATOR may say we can change LEDs to off/amber/green.
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
UBSAN whinge in ihci-hub.c Valdis Kletnieks <Valdis.Kletnieks@vt.edu> - 2016-05-18 00:00 +0200
Re: UBSAN whinge in ihci-hub.c Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-18 00:20 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 09:50 +0200
Re: UBSAN whinge in ihci-hub.c Oliver Neukum <oneukum@suse.com> - 2016-05-18 10:30 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 11:20 +0200
Re: UBSAN whinge in ihci-hub.c Oliver Neukum <oneukum@suse.com> - 2016-05-18 12:30 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 14:30 +0200
Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 16:50 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 17:10 +0200
Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 18:10 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-18 19:20 +0200
Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-18 21:30 +0200
Re: UBSAN whinge in ihci-hub.c Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2016-05-19 18:30 +0200
Re: UBSAN whinge in ihci-hub.c Alan Stern <stern@rowland.harvard.edu> - 2016-05-19 22:20 +0200
RE: UBSAN whinge in ihci-hub.c David Laight <David.Laight@ACULAB.COM> - 2016-05-23 18:10 +0200
csiph-web