From: Dan Carpenter <dan.carpenter@oracle.com> To: Petr Vandrovec <petr@vandrovec.name> Cc: Jan Kara <jack@suse.cz>, David Howells <dhowells@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Al Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ncpfs: don't allow negative timeouts Date: Tue, 10 Nov 2015 12:09:24 +0300 [thread overview] Message-ID: <20151110090924.GB2934@mwanda> (raw) 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@oracle.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;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Petr Vandrovec <petr@vandrovec.name> Cc: Jan Kara <jack@suse.cz>, David Howells <dhowells@redhat.com>, Andrew Morton <akpm@linux-foundation.org>, Al Viro <viro@zeniv.linux.org.uk>, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ncpfs: don't allow negative timeouts Date: Tue, 10 Nov 2015 09:09:24 +0000 [thread overview] Message-ID: <20151110090924.GB2934@mwanda> (raw) 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@oracle.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;
next reply other threads:[~2015-11-10 9:09 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-11-10 9:09 Dan Carpenter [this message] 2015-11-10 9:09 ` [patch] ncpfs: don't allow negative timeouts Dan Carpenter 2015-11-10 9:19 ` Jan Kara 2015-11-10 9:19 ` Jan Kara 2015-11-10 22:14 ` [patch v2] " Dan Carpenter 2015-11-10 22:14 ` Dan Carpenter 2015-11-11 7:35 ` Jan Kara 2015-11-11 7:35 ` Jan Kara
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20151110090924.GB2934@mwanda \ --to=dan.carpenter@oracle.com \ --cc=akpm@linux-foundation.org \ --cc=dhowells@redhat.com \ --cc=jack@suse.cz \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=petr@vandrovec.name \ --cc=viro@zeniv.linux.org.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.