Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468022

Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25

From Bjørn Mork <bjorn@mork.no>
Newsgroups linux.kernel
Subject Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25
Date 2016-08-22 22:30 +0200
Message-ID <s9413-2Ex-1@gated-at.bofh.it> (permalink)
References <s91we-Tx-13@gated-at.bofh.it>
Organization m

Show all headers | View raw


Alan Stern <stern@rowland.harvard.edu> writes:

> On Sun, 21 Aug 2016, Jiri Slaby wrote:
>
>> Cc: proper lists.
>> 
>> ep->desc.bInterval seems to be 0 here.
>> 
>> On 08/21/2016, 12:42 PM, Vittorio Zecca wrote:
>> > I am not sure this is the right place so please bear with me...
>> > From Vittorio Zecca
>> > 
>> > After compiling kernel 4.7.2 with ubsan I got the following messages
>> > at boot time:
>> > 
>> > (devio.c:1713 is "as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);")
>> > 
>> > [  +0.354486] ================================================================================
>> > [  +0.000008] UBSAN: Undefined behaviour in
>> > /home/vitti/1tb/vitti/rpmbuild/SOURCES/linux-4.7.2/drivers/usb/core/devio.c:1713:25
>> > [  +0.000004] shift exponent -1 is negative
>
> As far as I can see, this isn't possible.  The usb_parse_endpoint()  
> routine in drivers/usb/core/config.c is supposed to guarantee that
> ep->desc.bInterval is never 0.

That is if it is an ISO endpoint, right?

Maybe I misunderstand something fundamental, but the "||" strikes me as
odd here:

        as->urb->stream_id = stream_id;
        if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
                        ps->dev->speed == USB_SPEED_HIGH)
                as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
        else
                as->urb->interval = ep->desc.bInterval;
        as->urb->context = as;



Typo?



Bjørn

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: UBSAN: Undefined behaviour in  linux-4.7.2/drivers/usb/core/devio.c:1713:25 Jiri Slaby <jslaby@suse.cz> - 2016-08-21 12:50 +0200
  Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Alan Stern <stern@rowland.harvard.edu> - 2016-08-22 19:50 +0200
    Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Bjørn Mork <bjorn@mork.no> - 2016-08-22 22:30 +0200
      Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Alan Stern <stern@rowland.harvard.edu> - 2016-08-22 22:50 +0200
        Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Bjørn Mork <bjorn@mork.no> - 2016-08-22 23:00 +0200
          Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Alan Stern <stern@rowland.harvard.edu> - 2016-08-22 23:10 +0200
            Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Vittorio Zecca <zeccav@gmail.com> - 2016-08-22 23:50 +0200
              Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Alan Stern <stern@rowland.harvard.edu> - 2016-08-23 17:10 +0200
                Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Vittorio Zecca <zeccav@gmail.com> - 2016-08-23 18:00 +0200
                Re: UBSAN: Undefined behaviour in linux-4.7.2/drivers/usb/core/devio.c:1713:25 Alan Stern <stern@rowland.harvard.edu> - 2016-08-23 21:00 +0200

csiph-web