Skip to content

Commit

Permalink
lockd: fix arg parsing for grace_period and timeout.
Browse files Browse the repository at this point in the history
If you try to set grace_period or timeout via a module parameter
to lockd, and do this on a big-endian machine where

   sizeof(int) != sizeof(unsigned long)

it won't work.  This number given will be effectively shifted right
by the difference in those two sizes.

So cast kp->arg properly to get correct result.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
NeilBrown authored and J. Bruce Fields committed Feb 17, 2012
1 parent cec56c8 commit de5b8e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static int param_set_##name(const char *val, struct kernel_param *kp) \
__typeof__(type) num = which_strtol(val, &endp, 0); \
if (endp == val || *endp || num < (min) || num > (max)) \
return -EINVAL; \
*((int *) kp->arg) = num; \
*((type *) kp->arg) = num; \
return 0; \
}

Expand Down

0 comments on commit de5b8e8

Please sign in to comment.