[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJaqyWfeiAiNOBtGoEYK7PLncXLMO+wZ=Gse+=X0FO65qQO4LQ@mail.gmail.com>
Date: Mon, 29 Sep 2025 07:41:13 +0200
From: Eugenio Perez Martin <eperezma@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Yongji Xie <xieyongji@...edance.com>, linux-kernel@...r.kernel.org,
Maxime Coquelin <mcoqueli@...hat.com>, Stefano Garzarella <sgarzare@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Cindy Lu <lulu@...hat.com>,
virtualization@...ts.linux.dev, Laurent Vivier <lvivier@...hat.com>, jasowang@...hat.com
Subject: Re: [PATCH v5 0/6] Add multiple address spaces support to VDUSE
On Fri, Sep 26, 2025 at 4:37 PM Michael S. Tsirkin <mst@...hat.com> 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.
Powered by blists - more mailing lists