On Tue, Feb 12, 2019 at 12:58:43PM +0100, Lorenzo Bianconi wrote: > > + usb_fill_bulk_urb(buf->urb, udev, pipe, NULL, buf->len, complete_fn, > > + context); > > + > > + if (udev->bus->sg_tablesize > 0) { > > + buf->urb->num_sgs = buf->num_sgs; > > + } else { > > + WARN_ON_ONCE(buf->num_sgs != 1); > > + /* See usb_sg_init() */ > > + buf->urb->num_sgs = 0; > > + if (!PageHighMem(sg_page(buf->urb->sg))) > > + buf->urb->transfer_buffer = sg_virt(buf->urb->sg); > > please correct me if I am wrong but doing so we will use transfer_buffer > for 95% of the use cases, right? If so why not keep it simple and always > use it when sg_tablesize is 0 (avoiding SG I/O)? > > Btw this is what I proposed with the RFC series actually :) (always use > transfer_buffer in the usb 2.0 case) Because this way we do not change allocation method (use SG allocation) what is simpler IMHO than having two buffer allocation methods. And this way we do not hide problems with SG allocation and test it. Additionally this patch address actual bug: using wrong urb->num_sgs and can be easier to backport to older releases than 4 patch series. Stanislaw