Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9babc17 in mainline


Ignore:
Timestamp:
2011-12-06T15:43:03Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
e8d82cb
Parents:
e65cd3c4
Message:

ohci, root hub: Remove useless size check.

Response size is checked and data truncated in usb_batch_finish_error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/root_hub.c

    re65cd3c4 r9babc17  
    451451        const usb_device_request_setup_packet_t *setup_request =
    452452            (usb_device_request_setup_packet_t *) request->setup_buffer;
    453         size_t size;
    454         const void *descriptor = NULL;
    455453        const uint16_t setup_request_value = setup_request->value_high;
    456454        switch (setup_request_value)
     
    459457                usb_log_debug2("USB_DESCTYPE_HUB\n");
    460458                /* Hub descriptor was generated locally */
    461                 descriptor = instance->descriptors.hub;
    462                 size = instance->hub_descriptor_size;
    463                 break;
     459                TRANSFER_END_DATA(request, instance->descriptors.hub,
     460                    instance->hub_descriptor_size);
    464461
    465462        case USB_DESCTYPE_DEVICE:
    466463                usb_log_debug2("USB_DESCTYPE_DEVICE\n");
    467                 /* Device descriptor is shared (No one should ask for it)*/
    468                 descriptor = &ohci_rh_device_descriptor;
    469                 size = sizeof(ohci_rh_device_descriptor);
    470                 break;
     464                /* Device descriptor is shared (No one should ask for it) */
     465                TRANSFER_END_DATA(request, &ohci_rh_device_descriptor,
     466                    sizeof(ohci_rh_device_descriptor));
    471467
    472468        case USB_DESCTYPE_CONFIGURATION:
     
    474470                /* Start with configuration and add others depending on
    475471                 * request size */
    476                 descriptor = &instance->descriptors;
    477                 size = instance->descriptors.configuration.total_length;
    478                 break;
     472                TRANSFER_END_DATA(request, &instance->descriptors,
     473                    instance->descriptors.configuration.total_length);
    479474
    480475        case USB_DESCTYPE_INTERFACE:
     
    482477                /* Use local interface descriptor. There is one and it
    483478                 * might be modified */
    484                 descriptor = &instance->descriptors.interface;
    485                 size = sizeof(instance->descriptors.interface);
    486                 break;
     479                TRANSFER_END_DATA(request, &instance->descriptors.interface,
     480                    sizeof(instance->descriptors.interface));
    487481
    488482        case USB_DESCTYPE_ENDPOINT:
     
    490484                 * it might have max_packet_size field modified*/
    491485                usb_log_debug2("USB_DESCTYPE_ENDPOINT\n");
    492                 descriptor = &instance->descriptors.endpoint;
    493                 size = sizeof(instance->descriptors.endpoint);
    494                 break;
     486                TRANSFER_END_DATA(request, &instance->descriptors.endpoint,
     487                    sizeof(instance->descriptors.endpoint));
    495488
    496489        default:
     
    504497                TRANSFER_END(request, EINVAL);
    505498        }
    506         if (request->buffer_size < size) {
    507                 size = request->buffer_size;
    508         }
    509 
    510         TRANSFER_END_DATA(request, descriptor, size);
     499
     500        TRANSFER_END(request, ENOTSUP);
    511501}
    512502/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.