mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] genrtc: fix read on 64-bit platforms
Date: Fri, 28 Apr 2006 23:34:21 -0700	[thread overview]
Message-ID: <20060428233421.72e2faed.akpm@osdl.org> (raw)
In-Reply-To: <20060429.013857.37531336.anemo@mba.ocn.ne.jp>

Atsushi Nemoto <anemo@mba.ocn.ne.jp> 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);

  reply	other threads:[~2006-04-29  6:36 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 [this message]
2006-04-29 14:11   ` Atsushi Nemoto

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=20060428233421.72e2faed.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=anemo@mba.ocn.ne.jp \
    --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®