From: Andrei Vagin Date: Wed, 23 Mar 2022 23:06:20 +0000 (-0700) Subject: fs/pipe.c: local vars have to match types of proper pipe_inode_info fields X-Git-Tag: v6.1-rc5~1745^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aeb213cddeb5c31f8d418180e0b9956bfd53b018;p=platform%2Fkernel%2Flinux-starfive.git fs/pipe.c: local vars have to match types of proper pipe_inode_info fields 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 Suggested-by: Dmitry Safonov <0x7f454c46@gmail.com> Acked-by: Christian Brauner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/pipe.c b/fs/pipe.c index ba0841b..9648ac1 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -607,7 +607,7 @@ out: 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: @@ -829,7 +829,7 @@ out_free_uid: void free_pipe_info(struct pipe_inode_info *pipe) { - int i; + unsigned int i; #ifdef CONFIG_WATCH_QUEUE if (pipe->watch_queue)