public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Rob Radez <rob@osinvestor.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: WatchDog Driver Updates
Date: Sun, 7 Apr 2002 08:32:07 +0100	[thread overview]
Message-ID: <20020407083207.A28922@flint.arm.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.33.0204062139010.3791-100000@pita.lan>

On Sat, Apr 06, 2002 at 09:49:57PM -0500, Rob Radez wrote:
> I've put up a patch on http://osinvestor.com/bigwatchdog.diff against
> 2.4.19-pre5-ac3.  The diff is 33k, and it affects 19 files in drivers/char/,

And the purpose of this patch is...

1. copy_to_user is like memcpy() - it takes two pointers and an integer
   size.  You're passing it two integers and a pointer:

   static int wdt977_ioctl(... unsigned long arg)
   ...
            case WDIOC_GETSTATUS:
                   if(copy_to_user(arg, &timer_alive, sizeof(timer_alive)))
                              return -EFAULT;
                   return 0;

2. sizeof(int) != sizeof(unsigned long).  You've changed the ABI in an
   unsafe manner on 64-bit machines.  The ABI is defined by the ioctl
   numbers, which specify an 'int' type.

3. copy_to_user of an int or unsigned long is a bit inefficient.  Why
   not use put_user to write an int or unsigned long?

4. Unless I'm missing something, WDIOC_GETSTATUS can only ever return
   an indication that the timer is open/alive - it's set when the driver
   is opened, and cleared when it is closed.  Since you can't perform
   an ioctl on a closed device, the times that you can perform the ioctl,
   it'll always give you a non-zero result.

5. WDIOC_GETSTATUS is supposed to return the WDIOF_* flags.  Returning
   "watchdog active" as bit 0 causes it to indicate WDIOF_OVERHEAT.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2002-04-07  7:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-07  2:49 WatchDog Driver Updates Rob Radez
2002-04-07  7:32 ` Russell King [this message]
2002-04-07 10:35   ` Rob Radez
2002-04-07 10:52     ` Russell King
2002-04-07 10:58       ` Rob Radez
2002-04-07 13:32         ` Alan Cox
2002-04-07 13:34     ` Alan Cox
2002-04-07 13:48       ` Rob Radez
2002-04-07  9:15 ` Zwane Mwaikambo
2002-04-07 10:16   ` Rob Radez

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=20020407083207.A28922@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@osinvestor.com \
    /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