https://bugs.kde.org/show_bug.cgi?id=525637

            Bug ID: 525637
           Summary: ioctl(UFFDIO_API) complains about uninitialized out
                    parameter
    Classification: Developer tools
           Product: valgrind
      Version First 3.27 GIT
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

#include <stdio.h>
#include <unistd.h>
#include <linux/userfaultfd.h>
#include <linux/fs.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <fcntl.h>

int main() {
    struct uffdio_api uffdio_api;
    int uffd_fd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK |
UFFD_USER_MODE_ONLY);
    if (uffd_fd == -1)
    {
        puts("fail.");
        return 1;
    }

    uffdio_api.api = UFFD_API;
    uffdio_api.features = UFFD_FEATURE_WP_ASYNC | UFFD_FEATURE_WP_UNPOPULATED;
    if (ioctl(uffd_fd, UFFDIO_API, &uffdio_api) || uffdio_api.api != UFFD_API)
    {
        close(uffd_fd);
        puts("fail.");
        return 1;
    }
    puts("success.");
}


No particular flags needed, gcc's and valgrind's defaults are fine. Tested on
3.27.1 (not 3.27-git - the version field doesn't have a 3.27.1 option).

Expected: Print the usual Valgrind header/footer, and the success message.
Actual: Also prints a warning about uninitialized ioctl argument, the ioctls
field. https://www.man7.org/linux/man-pages/man2/UFFDIO_API.2const.html says
that field is out only, so the warning is unnecessary.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to