Commit 1491e30e authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Torvalds

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.  Let's
return an -EINVAL for negative timeouts.

[ remove unneeded `else']
Signed-off-by: default avatarDan Carpenter <>
Reviewed-by: default avatarJan Kara <>
Cc: Petr Vandrovec <>
Cc: David Howells <>
Cc: Jan Kara <>
Cc: Al Viro <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 5cf6a51e
......@@ -525,6 +525,8 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
switch (rqdata.cmd) {
if (rqdata.timeout < 0)
return -EINVAL;
if (rqdata.timeout == 0)
rqdata.timeout = NCP_LOCK_DEFAULT_TIMEOUT;
else if (rqdata.timeout > NCP_LOCK_MAX_TIMEOUT)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment