Re: [PATCH 3/9] iov_iter: overlay struct iovec and ubuf/len

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/28/23 4:16 PM, Linus Torvalds wrote:
> On Tue, Mar 28, 2023 at 2:58 PM Jens Axboe <axboe@xxxxxxxxx> wrote:
>>
>> +               struct iovec __ubuf_iovec;
> 
> This really should be "const struct iovec".
> 
> The only valid use for this is as an alternative to "iter->iov", and
> that one is a 'const' pointer too:

True, it should. But as per the cover letter, this only really
serves as a space filler, none of the code actually uses it. But
let's make it const, because that is the right thing to do.

>> +                               const struct iovec *iov;
> 
> and any code that tries to use it as a non-const iovec entry really is
> very very wrong.

Nobody should use it, though. The one case where I thought we'd use
it was iov_iter_iovec(), but that doesn't work...

> And yes, the current infiniband/hw/hfi1/* code does indeed do all of
> this wrong and cast the pointer to a non-const one, but that's
> actually just because somebody didn't do the const conversion right.
> 
> That cast should just go away, and hfi1_user_sdma_process_request()
> should just take a 'const struct iovec *iovec' argument.  It doesn't
> actually want to write to it anyway, so it's literally just a "change
> the prototype of the function" change.

Let's leave that for the IB people!

-- 
Jens Axboe





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux