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@xxxxxxxxxxxxx> >> --- >> 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: >> -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html