[PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path
Kumar Gala
galak at kernel.crashing.org
Tue Aug 7 02:13:55 EST 2012
On Aug 5, 2012, at 10:10 PM, tiejun.chen wrote:
> On 07/30/2012 04:15 PM, Tiejun Chen wrote:
>> We miss that correct WDIOC_GETSUPPORT return path when perform
>> copy_to_user() properly.
>
> Any comments?
>
> Thanks
> Tiejun
Adding Timur, as he's touched watchdog last.
- k
>> Signed-off-by: Tiejun Chen <tiejun.chen at windriver.com>
>> ---
>> drivers/watchdog/booke_wdt.c | 7 ++++---
>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
>> index 3fe82d0..2be7f29 100644
>> --- a/drivers/watchdog/booke_wdt.c
>> +++ b/drivers/watchdog/booke_wdt.c
>> @@ -162,12 +162,13 @@ static long booke_wdt_ioctl(struct file *file,
>> unsigned int cmd, unsigned long arg)
>> {
>> u32 tmp = 0;
>> - u32 __user *p = (u32 __user *)arg;
>> + void __user *argp = (u32 __user *)arg;
>> + u32 __user *p = argp;
>>
>> switch (cmd) {
>> case WDIOC_GETSUPPORT:
>> - if (copy_to_user((void *)arg, &ident, sizeof(ident)))
>> - return -EFAULT;
>> + return copy_to_user(argp, &ident,
>> + sizeof(ident)) ? -EFAULT : 0;
>> case WDIOC_GETSTATUS:
>> return put_user(0, p);
>> case WDIOC_GETBOOTSTATUS:
>>
More information about the Linuxppc-dev
mailing list