On Wed, Mar 29, 2023 at 11:41 AM Jens Axboe <axboe@xxxxxxxxx> wrote: > > + struct iovec __ubuf_iovec; I think this is the third time I say this: this should be "const struct iovec". No other use is ever valid, and this cast: > +static inline const struct iovec *iter_iov(const struct iov_iter *iter) > +{ > + if (iter->iter_type == ITER_UBUF) > + return (const struct iovec *) &iter->__ubuf_iovec; should simply not exist. The first rule of cast club is that casting one pointer to another is generally a sign that something is wrong. Casting a pointer to an integer? That's a valid way to get at the bit representation for things like tagged pointers or for virtual address arithmetic etc (ok, and by "valid" I mean "valid in kernel contexts - not necessarily in all other contexts). Casting an integer to a pointer? Same thing - some things just need to do bit operations on what will become a pointer (allocators etc). But casting a pointer to another one - that should basically always raise eyebrows. You should try really hard to avoid it. Yes, we do it in the kernel, and yes, it *can* be valid. But most of the time it's really a bad sign. Linus