As Jens Wiklander has proposed using iov_iter_ubuf() instead of import_ubuf(), should I propose a patch updating import_ubuf() and import_single_range()? Or would you prefer that we keep the functions unchanged for the time being?
Arguably it should be consistent with iovec imports, which return the length (or error). But it might be safer to just check access_ok() first and then truncate at least, vs what is there now.
Is the access_ok() check even needed when setting up an iov_iter? It is always checked again when the actual copy is done.
I looked at this a while back and couldn't see any code paths that relied on the early access_ok() check. Maybe it is historic?
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)