From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, alessandro.zummo@towertech.it
Subject: Re: [PATCH] genrtc: fix read on 64-bit platforms
Date: Sat, 29 Apr 2006 23:11:01 +0900 (JST) [thread overview]
Message-ID: <20060429.231101.115906349.anemo@mba.ocn.ne.jp> (raw)
In-Reply-To: <20060428233421.72e2faed.akpm@osdl.org>
On Fri, 28 Apr 2006 23:34:21 -0700, Andrew Morton <akpm@osdl.org> 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. Here is a same patch with an updated description.
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>
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);
prev parent reply other threads:[~2006-04-29 14:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-28 16:38 Atsushi Nemoto
2006-04-29 6:34 ` Andrew Morton
2006-04-29 14:11 ` Atsushi Nemoto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060429.231101.115906349.anemo@mba.ocn.ne.jp \
--to=anemo@mba.ocn.ne.jp \
--cc=akpm@osdl.org \
--cc=alessandro.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®