On 08/20/2014 04:46 PM, Jan Stancek wrote:
> Before kernel validates that fd is valid, it checks itimerspec struct
> with timespec_valid(). This struct is currently not initialised in test,
> which can cause failures, for example:
> 
> timerfd_settime01    1  TFAIL  :  timerfd_settime01.c:121: timerfd_settime()
>                         failed unexpectedly; expected: 9 - Bad file
>                         descriptor: TEST_ERRNO=EINVAL(22): Invalid argument
> timerfd_settime01    2  TFAIL  :  timerfd_settime01.c:121: timerfd_settime()
>                         failed unexpectedly; expected: 14 - Bad address:
>                         TEST_ERRNO=EINVAL(22): Invalid argument
> 
> Fix this by giving fields in this struct some deterministic values
> (zero in this patch).
> 
> Signed-off-by: Jan Stancek <jstan...@redhat.com>

Acked-by: Wanlong Gao <gaowanl...@cn.fujitsu.com>

> ---
>  .../kernel/syscalls/timerfd/timerfd_settime01.c    |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c 
> b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> index d12e40a..a1b04a5 100644
> --- a/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> +++ b/testcases/kernel/syscalls/timerfd/timerfd_settime01.c
> @@ -58,6 +58,7 @@ static void setup(void);
>  static void timerfd_settime_verify(const struct test_case_t *);
>  static void cleanup(void);
>  static int exp_enos[] = { EBADF, EFAULT, EINVAL, 0 };
> +static struct itimerspec new_value;
>  
>  int main(int argc, char *argv[])
>  {
> @@ -103,7 +104,6 @@ static void setup(void)
>  
>  static void timerfd_settime_verify(const struct test_case_t *test)
>  {
> -     struct itimerspec new_value;
>       TEST(timerfd_settime(*test->fd, test->flags, &new_value,
>                            test->old_value));
>  
> 


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to