From: Tabi Timur-B04825 <B04825@freescale.com> To: Tiejun Chen <tiejun.chen@windriver.com> Cc: "benh@kernel.crashing.org" <benh@kernel.crashing.org>, "galak@kernel.crashing.org" <galak@kernel.crashing.org>, "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>, "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org> Subject: Re: [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path Date: Mon, 6 Aug 2012 23:27:18 +0000 [thread overview] Message-ID: <CAOZdJXWftkUSw57-Qbe9JFP9NwodkHprKr6_1xi6ZzzLN8A4wA@mail.gmail.com> (raw) In-Reply-To: <1343636122-23273-1-git-send-email-tiejun.chen@windriver.com> On Mon, Jul 30, 2012 at 3:15 AM, Tiejun Chen <tiejun.chen@windriver.com> wrote: > We miss that correct WDIOC_GETSUPPORT return path when perform > copy_to_user() properly. Thanks for catching this. I'm amazed that this driver still has bugs like this. > 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; You don't need to create 'argp'. The existing 'p' variable will work in the copy_to_user() call. > + return copy_to_user(argp, &ident, > + sizeof(ident)) ? -EFAULT : 0; This can fit in one line, especially if you use 'p' instead of 'argp'. -- Timur Tabi Linux kernel developer at Freescale
WARNING: multiple messages have this Message-ID (diff)
From: Tabi Timur-B04825 <B04825@freescale.com> To: Tiejun Chen <tiejun.chen@windriver.com> Cc: "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>, "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org> Subject: Re: [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path Date: Mon, 6 Aug 2012 23:27:18 +0000 [thread overview] Message-ID: <CAOZdJXWftkUSw57-Qbe9JFP9NwodkHprKr6_1xi6ZzzLN8A4wA@mail.gmail.com> (raw) In-Reply-To: <1343636122-23273-1-git-send-email-tiejun.chen@windriver.com> On Mon, Jul 30, 2012 at 3:15 AM, Tiejun Chen <tiejun.chen@windriver.com> wr= ote: > We miss that correct WDIOC_GETSUPPORT return path when perform > copy_to_user() properly. Thanks for catching this. I'm amazed that this driver still has bugs like = this. > 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 =3D 0; > - u32 __user *p =3D (u32 __user *)arg; > + void __user *argp =3D (u32 __user *)arg; > + u32 __user *p =3D argp; You don't need to create 'argp'. The existing 'p' variable will work in the copy_to_user() call. > + return copy_to_user(argp, &ident, > + sizeof(ident)) ? -EFAULT : 0; This can fit in one line, especially if you use 'p' instead of 'argp'. --=20 Timur Tabi Linux kernel developer at Freescale=
next prev parent reply other threads:[~2012-08-06 23:28 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-30 8:15 [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path Tiejun Chen 2012-07-30 8:15 ` Tiejun Chen 2012-08-06 3:10 ` tiejun.chen 2012-08-06 3:10 ` tiejun.chen 2012-08-06 16:13 ` Kumar Gala 2012-08-06 16:13 ` Kumar Gala 2012-08-06 23:27 ` Tabi Timur-B04825 [this message] 2012-08-06 23:27 ` Tabi Timur-B04825 2012-08-06 23:36 ` Tabi Timur-B04825 2012-08-06 23:36 ` Tabi Timur-B04825 2012-08-07 1:56 ` tiejun.chen 2012-08-07 1:56 ` tiejun.chen
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=CAOZdJXWftkUSw57-Qbe9JFP9NwodkHprKr6_1xi6ZzzLN8A4wA@mail.gmail.com \ --to=b04825@freescale.com \ --cc=benh@kernel.crashing.org \ --cc=galak@kernel.crashing.org \ --cc=linux-watchdog@vger.kernel.org \ --cc=linuxppc-dev@ozlabs.org \ --cc=tiejun.chen@windriver.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.