flag parameters: check magic constants
[linux-2.6-block.git] / fs / timerfd.c
index 75d44efe346ca93bcded0b3a5df75568bd809aa1..c502c60e4f54ddfe6ac9402c2c550a274485b003 100644 (file)
@@ -184,6 +184,10 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
        int ufd;
        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))
                return -EINVAL;
        if (clockid != CLOCK_MONOTONIC &&