Skip to content

Commit

Permalink
autofs4: fix coding style problem in autofs4_get_set_timeout()
Browse files Browse the repository at this point in the history
Refactor autofs4_get_set_timeout() to eliminate coding style error.

Signed-off-by: Ian Kent <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
raven-au authored and torvalds committed Mar 15, 2016
1 parent e9a7c2f commit aa330dd
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions fs/autofs4/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,38 +774,50 @@ static int autofs4_dir_mkdir(struct inode *dir,
static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi,
compat_ulong_t __user *p)
{
int rv;
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)))
return rv;
rv = put_user(sbi->exp_timeout/HZ, p);
if (rv)
goto error;

if (ntimeout > UINT_MAX/HZ)
sbi->exp_timeout = 0;
else
sbi->exp_timeout = ntimeout * HZ;

return 0;
error:
return rv;
}
#endif

static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi,
unsigned long __user *p)
{
int rv;
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)))
return rv;
rv = put_user(sbi->exp_timeout/HZ, p);
if (rv)
goto error;

if (ntimeout > ULONG_MAX/HZ)
sbi->exp_timeout = 0;
else
sbi->exp_timeout = ntimeout * HZ;

return 0;
error:
return rv;
}

/* Return protocol version */
Expand Down

0 comments on commit aa330dd

Please sign in to comment.