Re: [RFC PATCH 1/3] fs/pipe: Limit the slots in pipe_resize_ring()
From: Oleg Nesterov
Date: Thu Mar 06 2025 - 07:29:08 EST
On 03/06, K Prateek Nayak wrote:
>
> @@ -1272,6 +1272,10 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)
> struct pipe_buffer *bufs;
> unsigned int head, tail, mask, n;
>
> + /* nr_slots larger than limits of pipe->{head,tail} */
> + if (unlikely(nr_slots > BIT(BITS_PER_TYPE(pipe_index_t) - 1)))
Hmm, perhaps
if (nr_slots > (pipe_index_t)-1u)
is more clear?
Oleg.