Commit de5b8e8e authored by NeilBrown's avatar NeilBrown Committed by J. Bruce Fields

lockd: fix arg parsing for grace_period and timeout.

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: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent cec56c8f
...@@ -440,7 +440,7 @@ static int param_set_##name(const char *val, struct kernel_param *kp) \ ...@@ -440,7 +440,7 @@ static int param_set_##name(const char *val, struct kernel_param *kp) \
__typeof__(type) num = which_strtol(val, &endp, 0); \ __typeof__(type) num = which_strtol(val, &endp, 0); \
if (endp == val || *endp || num < (min) || num > (max)) \ if (endp == val || *endp || num < (min) || num > (max)) \
return -EINVAL; \ return -EINVAL; \
*((int *) kp->arg) = num; \ *((type *) kp->arg) = num; \
return 0; \ return 0; \
} }
......
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