On Thu, 18 Apr 2019, zhuyan (M) wrote: > > > @@ -765,11 +765,12 @@ void fhci_queue_urb(struct fhci_hcd *fhci, > > > struct urb *urb) > > > > > > switch (ed->mode) { > > > case FHCI_TF_BULK: > > > + max_pkt_size = usb_endpoint_maxp(&urb->ep->desc); > > > if (urb->transfer_flags & URB_ZERO_PACKET && > > > urb->transfer_buffer_length > 0 && > > > + (max_pkt_size != 0) && > > > > Now you shouldn't need to add this extra test. > > > > Alan Stern > But the return value of usb_endpoint_maxp() may be 0. > Do we need to take protective measures? Yes, we do. But the protective measures don't belong in the fhci driver. They should go in core/config.c:usb_parse_endpoint(). That routine already has code to check for maxpacket sizes that are too large; you can add code that checks for maxpacket sizes that are too small. In theory an interrupt or isochronous endpoint might have maxpacket set to 0 -- we could warn about these and accept them -- but this is not allowed for bulk endpoints (see section 5.8.3 of the USB 2.0 specification). In fact, bulk endpoints are not allowed to have maxpacket size smaller than 8. Maybe if you make this change then fhci-hcd won't need any modifications at all. Alan Stern