Message ID | 20190917184023.16701-1-erosca@de.adit-jv.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 8f9577eda5b74de4bd8b186c67f20736bdea6e07 |
Headers | show |
Series | [v3,1/2] selftests: watchdog: Validate optional file argument | expand |
Hi Shuah, On Tue, Sep 17, 2019 at 08:40:22PM +0200, Eugeniu Rosca wrote: > From: "George G. Davis" <george_davis@mentor.com> > > The newly added optional file argument does not validate if the > file is indeed a watchdog, e.g.: > > ./watchdog-test -f /dev/zero > Watchdog Ticking Away! > > Fix it by confirming that the WDIOC_GETSUPPORT ioctl succeeds. > > Fixes: c3f2490d6e9257 ("selftests: watchdog: Add optional file argument") > Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com> > Signed-off-by: George G. Davis <george_davis@mentor.com> > Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> > --- > v3: > - Used v1 as starting point and simplified commit description > - Added Fixes tag (WARNING: commit id is from linux-next!) > - No change in the contents > - Applied cleanly to the same base as used in [v1] Can we have your confirmation the patches look fine now?
On 9/18/19 5:33 AM, Eugeniu Rosca wrote: > Hi Shuah, > > On Tue, Sep 17, 2019 at 08:40:22PM +0200, Eugeniu Rosca wrote: >> From: "George G. Davis" <george_davis@mentor.com> >> >> The newly added optional file argument does not validate if the >> file is indeed a watchdog, e.g.: >> >> ./watchdog-test -f /dev/zero >> Watchdog Ticking Away! >> >> Fix it by confirming that the WDIOC_GETSUPPORT ioctl succeeds. >> >> Fixes: c3f2490d6e9257 ("selftests: watchdog: Add optional file argument") >> Reported-by: Eugeniu Rosca <erosca@de.adit-jv.com> >> Signed-off-by: George G. Davis <george_davis@mentor.com> >> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> >> --- >> v3: >> - Used v1 as starting point and simplified commit description >> - Added Fixes tag (WARNING: commit id is from linux-next!) >> - No change in the contents >> - Applied cleanly to the same base as used in [v1] > > Can we have your confirmation the patches look fine now? > Hi Eugeniu, They both look good to me. I will apply these patches once the merge window closes or when my first pull request to Linus clears. You will see a notification when I apply them to kselftest tree. thanks, -- Shuah
Hi Shuah, On Wed, Sep 18, 2019 at 03:05:33PM -0600, Shuah wrote: [..] > They both look good to me. I will apply these patches once the merge > window closes or when my first pull request to Linus clears. > > You will see a notification when I apply them to kselftest tree. Many thanks for your prompt feedback.
Hi Shuah, On Tue, Oct 01, 2019 at 08:41:43PM +0000, patchwork-bot+linux-kselftest@kernel.org wrote: > Hello: > > This series was applied to shuah/linux-kselftest.git (refs/heads/fixes). > > On Tue, 17 Sep 2019 20:40:22 +0200 you wrote: > > From: "George G. Davis" <george_davis@mentor.com> > > > > The newly added optional file argument does not validate if the > > file is indeed a watchdog, e.g.: > > > > ./watchdog-test -f /dev/zero > > Watchdog Ticking Away! > > > > [...] > > Here is a summary with links: > - [v3,1/2] selftests: watchdog: Validate optional file argument > https://git.kernel.org/shuah/linux-kselftest/c/93c384f5d553bc4fdfb252b89ff378363ee05cee Could you please update the 'Fixes:' tag in the above commit to: Fixes: a4864a33f56caa ("selftests: watchdog: Add optional file argument") The warning in https://patchwork.kernel.org/patch/11149287/ clearly says that the fixed commit is from linux-next and it seems to have been updated before landing in mainline. TIA.
On 10/2/19 4:41 AM, Eugeniu Rosca wrote: > Hi Shuah, > > On Tue, Oct 01, 2019 at 08:41:43PM +0000, patchwork-bot+linux-kselftest@kernel.org wrote: >> Hello: >> >> This series was applied to shuah/linux-kselftest.git (refs/heads/fixes). >> >> On Tue, 17 Sep 2019 20:40:22 +0200 you wrote: >>> From: "George G. Davis" <george_davis@mentor.com> >>> >>> The newly added optional file argument does not validate if the >>> file is indeed a watchdog, e.g.: >>> >>> ./watchdog-test -f /dev/zero >>> Watchdog Ticking Away! >>> >>> [...] >> >> Here is a summary with links: >> - [v3,1/2] selftests: watchdog: Validate optional file argument >> https://git.kernel.org/shuah/linux-kselftest/c/93c384f5d553bc4fdfb252b89ff378363ee05cee > > Could you please update the 'Fixes:' tag in the above commit to: > Fixes: a4864a33f56caa ("selftests: watchdog: Add optional file argument") > > The warning in https://patchwork.kernel.org/patch/11149287/ clearly says > that the fixed commit is from linux-next and it seems to have been > updated before landing in mainline. TIA. > Thanks. My scripts didn't catch it for some reason. Fixed now. -- Shuah
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index afff120c7be6..6ed822dc2222 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c @@ -97,6 +97,7 @@ int main(int argc, char *argv[]) int c; int oneshot = 0; char *file = "/dev/watchdog"; + struct watchdog_info info; setbuf(stdout, NULL); @@ -118,6 +119,16 @@ int main(int argc, char *argv[]) exit(-1); } + /* + * Validate that `file` is a watchdog device + */ + ret = ioctl(fd, WDIOC_GETSUPPORT, &info); + if (ret) { + printf("WDIOC_GETSUPPORT error '%s'\n", strerror(errno)); + close(fd); + exit(ret); + } + optind = 0; while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {