Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e38b36f3 authored by Ulrich Drepper's avatar Ulrich Drepper Committed by Linus Torvalds
Browse files

flag parameters: check magic constants



This patch adds test that ensure the boundary conditions for the various
constants introduced in the previous patches is met.  No code is generated.

[akpm@linux-foundation.org: fix alpha]
Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
Acked-by: default avatarDavide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 510df2dd
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -203,6 +203,10 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
	int fd;
	int fd;
	struct eventfd_ctx *ctx;
	struct eventfd_ctx *ctx;


	/* Check the EFD_* constants for consistency.  */
	BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC);
	BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK);

	if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK))
	if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK))
		return -EINVAL;
		return -EINVAL;


+3 −0
Original line number Original line Diff line number Diff line
@@ -1051,6 +1051,9 @@ asmlinkage long sys_epoll_create2(int size, int flags)
	int error, fd = -1;
	int error, fd = -1;
	struct eventpoll *ep;
	struct eventpoll *ep;


	/* Check the EPOLL_* constant for consistency.  */
	BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);

	if (flags & ~EPOLL_CLOEXEC)
	if (flags & ~EPOLL_CLOEXEC)
		return -EINVAL;
		return -EINVAL;


+4 −0
Original line number Original line Diff line number Diff line
@@ -574,6 +574,10 @@ asmlinkage long sys_inotify_init1(int flags)
	struct file *filp;
	struct file *filp;
	int fd, ret;
	int fd, ret;


	/* Check the IN_* constants for consistency.  */
	BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC);
	BUILD_BUG_ON(IN_NONBLOCK != O_NONBLOCK);

	if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
	if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
		return -EINVAL;
		return -EINVAL;


+4 −0
Original line number Original line Diff line number Diff line
@@ -211,6 +211,10 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
	sigset_t sigmask;
	sigset_t sigmask;
	struct signalfd_ctx *ctx;
	struct signalfd_ctx *ctx;


	/* Check the SFD_* constants for consistency.  */
	BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
	BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);

	if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
	if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
		return -EINVAL;
		return -EINVAL;


+4 −0
Original line number Original line Diff line number Diff line
@@ -184,6 +184,10 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
	int ufd;
	int ufd;
	struct timerfd_ctx *ctx;
	struct timerfd_ctx *ctx;


	/* Check the TFD_* constants for consistency.  */
	BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
	BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);

	if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
	if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
		return -EINVAL;
		return -EINVAL;
	if (clockid != CLOCK_MONOTONIC &&
	if (clockid != CLOCK_MONOTONIC &&
Loading