]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
lockd: fix arg parsing for grace_period and timeout.
authorNeilBrown <neilb@suse.de>
Tue, 7 Feb 2012 04:35:42 +0000 (15:35 +1100)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 17 Feb 2012 23:38:51 +0000 (18:38 -0500)
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>
fs/lockd/svc.c

index c061b9aa7ddb165c4b5241e73d9c8bb943f2f678..2444780f5cfa061eaea1c1930646bd6d7ff04ee1 100644 (file)
@@ -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;                                                       \
 }