Skip to content

Commit

Permalink
fs/pipe.c: local vars have to match types of proper pipe_inode_info f…
Browse files Browse the repository at this point in the history
…ields

head, tail, ring_size are declared as unsigned int, so all local variables
that operate with these fields have to be unsigned to avoid signed integer
overflow.

Right now, it isn't an issue because the maximum pipe size is limited by
1U<<31.

Link: https://lkml.kernel.org/r/20220106171946.36128-1-avagin@gmail.com
Signed-off-by: Andrei Vagin <avagin@gmail.com>
Suggested-by: Dmitry Safonov <0x7f454c46@gmail.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
  • Loading branch information
avagin authored and sfrothwell committed Feb 9, 2022
1 parent 8e94278 commit 2cbc479
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from)
static long pipe_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct pipe_inode_info *pipe = filp->private_data;
int count, head, tail, mask;
unsigned int count, head, tail, mask;

switch (cmd) {
case FIONREAD:
Expand Down Expand Up @@ -828,7 +828,7 @@ struct pipe_inode_info *alloc_pipe_info(void)

void free_pipe_info(struct pipe_inode_info *pipe)
{
int i;
unsigned int i;

#ifdef CONFIG_WATCH_QUEUE
if (pipe->watch_queue) {
Expand Down

0 comments on commit 2cbc479

Please sign in to comment.