aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2006-05-01 15:16:17 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-05-01 21:17:47 -0400
commitf3537ea7b9c2f10397a8b68cd006981d7c615431 (patch)
tree4aedb112b5e39c09238f533804fc35996c58eeb0 /drivers/char
parent3418ff76119da52f808eb496191d1fd380f53f3d (diff)
[PATCH] genrtc: fix read on 64-bit platforms
Fix genrtc's read() routine for 64-bit platforms. Current gen_rtc_read() stores 64bit integer and returns 8 even if an user tried to read a 32bit integer. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/genrtc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index d3a2bc36129b..588fca542a98 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -200,13 +200,13 @@ static ssize_t gen_rtc_read(struct file *file, char __user *buf,
200 /* first test allows optimizer to nuke this case for 32-bit machines */ 200 /* first test allows optimizer to nuke this case for 32-bit machines */
201 if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) { 201 if (sizeof (int) != sizeof (long) && count == sizeof (unsigned int)) {
202 unsigned int uidata = data; 202 unsigned int uidata = data;
203 retval = put_user(uidata, (unsigned long __user *)buf); 203 retval = put_user(uidata, (unsigned int __user *)buf) ?:
204 sizeof(unsigned int);
204 } 205 }
205 else { 206 else {
206 retval = put_user(data, (unsigned long __user *)buf); 207 retval = put_user(data, (unsigned long __user *)buf) ?:
208 sizeof(unsigned long);
207 } 209 }
208 if (!retval)
209 retval = sizeof(unsigned long);
210 out: 210 out:
211 current->state = TASK_RUNNING; 211 current->state = TASK_RUNNING;
212 remove_wait_queue(&gen_rtc_wait, &wait); 212 remove_wait_queue(&gen_rtc_wait, &wait);