On Mon, Sep 29, 2025 at 07:41:13AM +0200, Eugenio Perez Martin wrote: > On Fri, Sep 26, 2025 at 4:37 PM Michael S. Tsirkin <[email protected]> wrote: > > > > On Fri, Sep 26, 2025 at 12:14:26PM +0200, Eugenio Pérez wrote: > > > PATCH v5: > > > * Properly return errno if copy_to_user returns >0 in VDUSE_IOTLB_GET_FD > > > ioctl (Jason). > > > > ??? > > > > I think copy_to_user returns an unsigned value: the number of bytes copied. > > > > > > static __always_inline unsigned long __must_check > > copy_from_user(void *to, const void __user *from, unsigned long n) > > { > > if (!check_copy_size(to, n, false)) > > return n; > > #ifdef INLINE_COPY_FROM_USER > > return _inline_copy_from_user(to, from, n); > > #else > > return _copy_from_user(to, from, n); > > #endif > > } > > > > > > so, how does the patch work then? > > > > copy_from_user returns the number of bytes that could not be copied. > For example when the object size in the kernel is less than n bytes > long, check_copy_size returns false and copy_from_user returns n, the > amount of size requested to copy.
oh, right. thanks!

