On Mon, Jul 24, 2023 at 04:31:08PM +0200, Oliver Neukum wrote: > On 24.07.23 16:29, Alan Stern wrote: > > How can it? bDescriptorType is at the start of the device descriptor, > > whereas bMaxPacketSize0 is more towards the end. If the later part get > > transferred from the device, the earlier part must have been transferred > > as well. Even if the transfer was short. > > Do we really guarantee that in an error case the buffer is filled from front > to back? We don't guarantee anything in an error case. But for short transfers with no other errors, yes, this is guaranteed. However if you still want to address this concern, just set buf->bDescriptorType to 0 at the same time as buf->bMaxPacketSize0. Alan Stern