Re: [PATCH] lockd: fix arg parsing for grace_period and timeout.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-02-07 at 15:35 +1100, NeilBrown wrote:
> 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 <neilb@xxxxxxx>
> 
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index c061b9a..2444780 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;							\
>  }
>  
Wow, that's a seriously old bug... Bruce, do you want to carry it?

Trond
-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux