[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f436638-1aa8-48b9-95db-cef81a6333b4@redhat.com>
Date: Mon, 16 Jun 2025 12:27:47 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Akihiko Odaki <akihiko.odaki@...nix.com>, netdev@...r.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
Jason Wang <jasowang@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, "Michael S. Tsirkin" <mst@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez
<eperezma@...hat.com>, Yuri Benditovich <yuri.benditovich@...nix.com>
Subject: Re: [PATCH RFC v3 3/8] vhost-net: allow configuring extended features
On 6/16/25 10:57 AM, Akihiko Odaki wrote:
> On 2025/06/14 16:27, Paolo Abeni wrote:
>> On 6/8/25 8:16 AM, Akihiko Odaki wrote:
>>> On 2025/06/06 20:45, Paolo Abeni wrote:
>>>> +
>>>> + /* Zero the trailing space provided by user-space, if any */
>>>> + if (i < count && clear_user(argp, (count - i) * sizeof(u64)))
>>>
>>> I think checking i < count is a premature optimization; it doesn't
>>> matter even if we spend a bit longer because of the lack of the check.
>>
>> FTR, the check is not an optimization. if `i` is greater than `count`,
>> `clear_user` is going to try to clear almost all the memory space (the
>> 2nd argument is an unsigned one) and will likely return with error.
>>
>> I think it's functionally needed.
>
> The for loop tells i cannot be greater than count, so i < count will be
> false only when i == count.
Right you are, /me goes grabbing more coffee...
Thanks,
Paolo
Powered by blists - more mailing lists