Re: [PATCH] genrtc: fix read on 64-bit platforms

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

 



Atsushi Nemoto <[email protected]> wrote:
>
> Fix genrtc's read() routine for 64-bit platforms.
> 

When fixing something, please provide a description of what the problem was
and also a description of how the patch fixes it (unless it's obvious, of
course).

Thanks.

> 
> diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
> index d3a2bc3..588fca5 100644
> --- a/drivers/char/genrtc.c
> +++ b/drivers/char/genrtc.c
> @@ -200,13 +200,13 @@ static ssize_t gen_rtc_read(struct file 
>  	/* first test allows optimizer to nuke this case for 32-bit machines */
>  	if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) {
>  		unsigned int uidata = data;
> -		retval = put_user(uidata, (unsigned long __user *)buf);
> +		retval = put_user(uidata, (unsigned int __user *)buf) ?:
> +			sizeof(unsigned int);
>  	}
>  	else {
> -		retval = put_user(data, (unsigned long __user *)buf);
> +		retval = put_user(data, (unsigned long __user *)buf) ?:
> +			sizeof(unsigned long);
>  	}
> -	if (!retval)
> -		retval = sizeof(unsigned long);
>   out:
>  	current->state = TASK_RUNNING;
>  	remove_wait_queue(&gen_rtc_wait, &wait);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux