aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-07-24 00:29:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:29 -0400
commite38b36f325153eaadd1c2a7abc5762079233e540 (patch)
tree92cfc9855e41c5328d91456f5e373c00ecb8d383 /fs
parent510df2dd482496083e1c3b1a8c9b6afd5fa4c7d7 (diff)
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: Ulrich Drepper <drepper@redhat.com> Acked-by: Davide Libenzi <davidel@xmailserver.org> Cc: Michael Kerrisk <mtk.manpages@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/eventfd.c4
-rw-r--r--fs/eventpoll.c3
-rw-r--r--fs/inotify_user.c4
-rw-r--r--fs/signalfd.c4
-rw-r--r--fs/timerfd.c4
5 files changed, 19 insertions, 0 deletions
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 3ed4466177a7..08bf558d0408 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -203,6 +203,10 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
203 int fd; 203 int fd;
204 struct eventfd_ctx *ctx; 204 struct eventfd_ctx *ctx;
205 205
206 /* Check the EFD_* constants for consistency. */
207 BUILD_BUG_ON(EFD_CLOEXEC != O_CLOEXEC);
208 BUILD_BUG_ON(EFD_NONBLOCK != O_NONBLOCK);
209
206 if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK)) 210 if (flags & ~(EFD_CLOEXEC | EFD_NONBLOCK))
207 return -EINVAL; 211 return -EINVAL;
208 212
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3fd4014f3c5a..2fdad4204044 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1051,6 +1051,9 @@ asmlinkage long sys_epoll_create2(int size, int flags)
1051 int error, fd = -1; 1051 int error, fd = -1;
1052 struct eventpoll *ep; 1052 struct eventpoll *ep;
1053 1053
1054 /* Check the EPOLL_* constant for consistency. */
1055 BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC);
1056
1054 if (flags & ~EPOLL_CLOEXEC) 1057 if (flags & ~EPOLL_CLOEXEC)
1055 return -EINVAL; 1058 return -EINVAL;
1056 1059
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index dc7e1f619748..fe79c25d95dc 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -574,6 +574,10 @@ asmlinkage long sys_inotify_init1(int flags)
574 struct file *filp; 574 struct file *filp;
575 int fd, ret; 575 int fd, ret;
576 576
577 /* Check the IN_* constants for consistency. */
578 BUILD_BUG_ON(IN_CLOEXEC != O_CLOEXEC);
579 BUILD_BUG_ON(IN_NONBLOCK != O_NONBLOCK);
580
577 if (flags & ~(IN_CLOEXEC | IN_NONBLOCK)) 581 if (flags & ~(IN_CLOEXEC | IN_NONBLOCK))
578 return -EINVAL; 582 return -EINVAL;
579 583
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 5441a4bca772..9c39bc7f8431 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -211,6 +211,10 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
211 sigset_t sigmask; 211 sigset_t sigmask;
212 struct signalfd_ctx *ctx; 212 struct signalfd_ctx *ctx;
213 213
214 /* Check the SFD_* constants for consistency. */
215 BUILD_BUG_ON(SFD_CLOEXEC != O_CLOEXEC);
216 BUILD_BUG_ON(SFD_NONBLOCK != O_NONBLOCK);
217
214 if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK)) 218 if (flags & ~(SFD_CLOEXEC | SFD_NONBLOCK))
215 return -EINVAL; 219 return -EINVAL;
216 220
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 75d44efe346c..c502c60e4f54 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -184,6 +184,10 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
184 int ufd; 184 int ufd;
185 struct timerfd_ctx *ctx; 185 struct timerfd_ctx *ctx;
186 186
187 /* Check the TFD_* constants for consistency. */
188 BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
189 BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
190
187 if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) 191 if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
188 return -EINVAL; 192 return -EINVAL;
189 if (clockid != CLOCK_MONOTONIC && 193 if (clockid != CLOCK_MONOTONIC &&