Commit 571d4a87 authored by Andi Kleen's avatar Andi Kleen Committed by David S. Miller

[PATCH] Minor 32bit compatibility fix for /dev/rtc

Handle both unsigned int and unsigned long in rtc_read. This helps
when running 32bit userland under an 64bit kernel.
parent 7197ce26
......@@ -279,7 +279,7 @@ static ssize_t rtc_read(struct file *file, char *buf,
if (rtc_has_irq == 0)
return -EIO;
if (count < sizeof(unsigned long))
if (count < sizeof(unsigned))
return -EINVAL;
add_wait_queue(&rtc_wait, &wait);
......@@ -310,9 +310,10 @@ static ssize_t rtc_read(struct file *file, char *buf,
schedule();
} while (1);
retval = put_user(data, (unsigned long *)buf);
if (!retval)
retval = sizeof(unsigned long);
if (count < sizeof(unsigned long))
retval = put_user(data, (unsigned int *)buf) ?: sizeof(int);
else
retval = put_user(data, (unsigned long *)buf) ?: sizeof(long);
out:
current->state = TASK_RUNNING;
remove_wait_queue(&rtc_wait, &wait);
......
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