summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2022-02-02 12:04:54 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2022-02-02 12:04:54 +1100
commitf21321dfe8af69275028b1034cf3ff42b34e0a1d (patch)
tree4e94720fba30dc0d7a9cff75bb62c971abc679c4
parent8620759d4b310ed21233973126cd1439e76331cd (diff)
downloadlinux-f21321dfe8af69275028b1034cf3ff42b34e0a1d.tar.gz
linux-f21321dfe8af69275028b1034cf3ff42b34e0a1d.tar.xz
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 <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>
-rw-r--r--fs/pipe.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index 3e3413a4ccc2..71946832e33f 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -606,7 +606,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:
@@ -828,7 +828,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) {