From: NeilBrown Date: Tue, 7 Feb 2012 04:35:42 +0000 (+1100) Subject: lockd: fix arg parsing for grace_period and timeout. X-Git-Tag: v2.6.39-400.9.0~426^2~14^2~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d2033954291d7a9b7d2ab8bb0595dd142421a770;p=users%2Fjedix%2Flinux-maple.git lockd: fix arg parsing for grace_period and timeout. commit de5b8e8e047534aac6bc9803f96e7257436aef9c upstream. 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. Signed-off-by: NeilBrown Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index abfff9d7979dc..1743064cd0cee 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -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; \ }