[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151110090924.GB2934@mwanda>
Date: Tue, 10 Nov 2015 12:09:24 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Petr Vandrovec <petr@...drovec.name>
Cc: Jan Kara <jack@...e.cz>, David Howells <dhowells@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] ncpfs: don't allow negative timeouts
This code causes a static checker warning because it's a user controlled
variable where we cap the upper bound but not the lower bound. If
someone passes us a negative timeout then I guess lets set it to the
default.
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c
index 79b1130..c07498a 100644
--- a/fs/ncpfs/ioctl.c
+++ b/fs/ncpfs/ioctl.c
@@ -525,7 +525,7 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
switch (rqdata.cmd) {
case NCP_LOCK_EX:
case NCP_LOCK_SH:
- if (rqdata.timeout == 0)
+ if (rqdata.timeout <= 0)
rqdata.timeout = NCP_LOCK_DEFAULT_TIMEOUT;
else if (rqdata.timeout > NCP_LOCK_MAX_TIMEOUT)
rqdata.timeout = NCP_LOCK_MAX_TIMEOUT;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists