• Thomas Weißschuh's avatar
    selftests/nolibc: libc-test: avoid -Wstringop-overflow warnings · 4ed03f63
    Thomas Weißschuh authored
    Newer versions of glibc annotate the poll() function with
    __attribute__(access) which triggers a compiler warning inside the
    testcase poll_fault.
    Avoid this by using a plain NULL which is enough for the testcase.
    To avoid potential future warnings also adapt the other EFAULT
    testcases, except select_fault as NULL is a valid value for its
    argument.
    
    nolibc-test.c: In function ‘run_syscall’:
    nolibc-test.c:338:62: warning: ‘poll’ writing 8 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
      338 |         do { if (!(cond)) result(llen, SKIPPED); else ret += expect_syserr2(expr, expret, experr1, experr2, llen); } while (0)
          |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    nolibc-test.c:341:9: note: in expansion of macro ‘EXPECT_SYSER2’
      341 |         EXPECT_SYSER2(cond, expr, expret, experr, 0)
          |         ^~~~~~~~~~~~~
    nolibc-test.c:905:47: note: in expansion of macro ‘EXPECT_SYSER’
      905 |                 CASE_TEST(poll_fault);        EXPECT_SYSER(1, poll((void *)1, 1, 0), -1, EFAULT); break;
          |                                               ^~~~~~~~~~~~
    cc1: note: destination object is likely at address zero
    In file included from /usr/include/poll.h:1,
                     from nolibc-test.c:33:
    /usr/include/sys/poll.h:54:12: note: in a call to function ‘poll’ declared with attribute ‘access (write_only, 1, 2)’
       54 | extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout)
          |            ^~~~
    Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
    4ed03f63
nolibc-test.c 41.6 KB