diff mbox series

[1/2] clock_getres01: pass non-NULL res as parameter

Message ID 76fa74b68aa0794f58e01d5794fffa3a02df0203.1565089789.git.jstancek@redhat.com
State Superseded
Headers show
Series [1/2] clock_getres01: pass non-NULL res as parameter | expand

Commit Message

Jan Stancek Aug. 6, 2019, 11:10 a.m. UTC
Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
VDSO treats NULL parameter differently than in syscall.

Pass valid pointer. Subsequent patch will add test variants that test NULL
res parameter using syscall.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/clock_getres/clock_getres01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Li Wang Aug. 7, 2019, 8:16 a.m. UTC | #1
Hi Jan,

On Tue, Aug 6, 2019 at 7:11 PM Jan Stancek <jstancek@redhat.com> wrote:
>
> Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer checks")
> VDSO treats NULL parameter differently than in syscall.
>
> Pass valid pointer. Subsequent patch will add test variants that test NULL
> res parameter using syscall.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  testcases/kernel/syscalls/clock_getres/clock_getres01.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> index 15f32310839a..6b556965530e 100644
> --- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> +++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> @@ -28,7 +28,7 @@ static struct test_case {
>         {"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
>         {"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
>         {"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
> -       {"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
> +       {"REALTIME", CLOCK_REALTIME, &res, 0, 0},

If we change NULL to &res, it will be a duplicate of the first case.
So my suggest here is to remove it directly, since patch2/2 has
already added variants to test NULL via syscall.

Otherwise, the patchset looks good.

>         {"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
>         {"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
>         {"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},
> --
> 1.8.3.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
Jan Stancek Aug. 7, 2019, 11:19 a.m. UTC | #2
----- Original Message -----
> Hi Jan,
> 
> On Tue, Aug 6, 2019 at 7:11 PM Jan Stancek <jstancek@redhat.com> wrote:
> >
> > Since commit a9446a906f52 ("lib/vdso/32: Remove inconsistent NULL pointer
> > checks")
> > VDSO treats NULL parameter differently than in syscall.
> >
> > Pass valid pointer. Subsequent patch will add test variants that test NULL
> > res parameter using syscall.
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  testcases/kernel/syscalls/clock_getres/clock_getres01.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > index 15f32310839a..6b556965530e 100644
> > --- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > +++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
> > @@ -28,7 +28,7 @@ static struct test_case {
> >         {"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
> >         {"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
> >         {"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
> > -       {"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
> > +       {"REALTIME", CLOCK_REALTIME, &res, 0, 0},
> 
> If we change NULL to &res, it will be a duplicate of the first case.
> So my suggest here is to remove it directly, since patch2/2 has
> already added variants to test NULL via syscall.

Not sure how I didn't see that, but I agree that it can be dropped.

> 
> Otherwise, the patchset looks good.
> 
> >         {"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
> >         {"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
> >         {"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},
> > --
> > 1.8.3.1
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> 
> 
> --
> Regards,
> Li Wang
>
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index 15f32310839a..6b556965530e 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -28,7 +28,7 @@  static struct test_case {
 	{"MONOTONIC", CLOCK_MONOTONIC, &res, 0, 0},
 	{"PROCESS_CPUTIME_ID", CLOCK_PROCESS_CPUTIME_ID, &res, 0, 0},
 	{"THREAD_CPUTIME_ID", CLOCK_THREAD_CPUTIME_ID, &res, 0, 0},
-	{"REALTIME", CLOCK_REALTIME, NULL, 0, 0},
+	{"REALTIME", CLOCK_REALTIME, &res, 0, 0},
 	{"CLOCK_MONOTONIC_RAW", CLOCK_MONOTONIC_RAW, &res, 0, 0,},
 	{"CLOCK_REALTIME_COARSE", CLOCK_REALTIME_COARSE, &res, 0, 0,},
 	{"CLOCK_MONOTONIC_COARSE", CLOCK_MONOTONIC_COARSE, &res, 0, 0,},