提交 aa330ddc 编写于 作者: I Ian Kent 提交者: Linus Torvalds

autofs4: fix coding style problem in autofs4_get_set_timeout()

Refactor autofs4_get_set_timeout() to eliminate coding style error.
Signed-off-by: NIan Kent <raven@themaw.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e9a7c2f1
...@@ -774,12 +774,16 @@ static int autofs4_dir_mkdir(struct inode *dir, ...@@ -774,12 +774,16 @@ static int autofs4_dir_mkdir(struct inode *dir,
static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
compat_ulong_t __user *p) compat_ulong_t __user *p)
{ {
int rv;
unsigned long ntimeout; unsigned long ntimeout;
int rv;
rv = get_user(ntimeout, p);
if (rv)
goto error;
if ((rv = get_user(ntimeout, p)) || rv = put_user(sbi->exp_timeout/HZ, p);
(rv = put_user(sbi->exp_timeout/HZ, p))) if (rv)
return rv; goto error;
if (ntimeout > UINT_MAX/HZ) if (ntimeout > UINT_MAX/HZ)
sbi->exp_timeout = 0; sbi->exp_timeout = 0;
...@@ -787,18 +791,24 @@ static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, ...@@ -787,18 +791,24 @@ static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
sbi->exp_timeout = ntimeout * HZ; sbi->exp_timeout = ntimeout * HZ;
return 0; return 0;
error:
return rv;
} }
#endif #endif
static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
unsigned long __user *p) unsigned long __user *p)
{ {
int rv;
unsigned long ntimeout; unsigned long ntimeout;
int rv;
rv = get_user(ntimeout, p);
if (rv)
goto error;
if ((rv = get_user(ntimeout, p)) || rv = put_user(sbi->exp_timeout/HZ, p);
(rv = put_user(sbi->exp_timeout/HZ, p))) if (rv)
return rv; goto error;
if (ntimeout > ULONG_MAX/HZ) if (ntimeout > ULONG_MAX/HZ)
sbi->exp_timeout = 0; sbi->exp_timeout = 0;
...@@ -806,6 +816,8 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, ...@@ -806,6 +816,8 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
sbi->exp_timeout = ntimeout * HZ; sbi->exp_timeout = ntimeout * HZ;
return 0; return 0;
error:
return rv;
} }
/* Return protocol version */ /* Return protocol version */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册