From: Jan Kara <jack@suse.cz> To: Dan Carpenter <dan.carpenter@oracle.com> Cc: Petr Vandrovec <petr@vandrovec.name>, 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: Re: [patch] ncpfs: don't allow negative timeouts Date: Tue, 10 Nov 2015 10:19:23 +0100 [thread overview] Message-ID: <20151110091923.GE26699@quack.suse.cz> (raw) In-Reply-To: <20151110090924.GB2934@mwanda> On Tue 10-11-15 12:09:24, Dan Carpenter wrote: > 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> IMHO it would be better to return error from the ioctl. Currently it would just wrap when converting to u16 anyway... Honza > > 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; -- Jan Kara <jack@suse.com> SUSE Labs, CR
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz> To: Dan Carpenter <dan.carpenter@oracle.com> Cc: Petr Vandrovec <petr@vandrovec.name>, 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: Re: [patch] ncpfs: don't allow negative timeouts Date: Tue, 10 Nov 2015 09:19:23 +0000 [thread overview] Message-ID: <20151110091923.GE26699@quack.suse.cz> (raw) In-Reply-To: <20151110090924.GB2934@mwanda> On Tue 10-11-15 12:09:24, Dan Carpenter wrote: > 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> IMHO it would be better to return error from the ioctl. Currently it would just wrap when converting to u16 anyway... Honza > > 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; -- Jan Kara <jack@suse.com> SUSE Labs, CR
next prev parent reply other threads:[~2015-11-10 9:19 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-11-10 9:09 [patch] ncpfs: don't allow negative timeouts Dan Carpenter 2015-11-10 9:09 ` Dan Carpenter 2015-11-10 9:19 ` Jan Kara [this message] 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=20151110091923.GE26699@quack.suse.cz \ --to=jack@suse.cz \ --cc=akpm@linux-foundation.org \ --cc=dan.carpenter@oracle.com \ --cc=dhowells@redhat.com \ --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.