OSDN Git Service

crypto: talitos - HMAC SNOOP NO AFEU mode requires SW icv checking.
[android-x86/kernel.git] / fs / fcntl.c
index 350a2c8..ec03cf6 100644 (file)
@@ -114,6 +114,10 @@ void f_setown(struct file *filp, unsigned long arg, int force)
        int who = arg;
        type = PIDTYPE_PID;
        if (who < 0) {
+               /* avoid overflow below */
+               if (who == INT_MIN)
+                       return;
+
                type = PIDTYPE_PGID;
                who = -who;
        }
@@ -741,16 +745,10 @@ static int __init fcntl_init(void)
         * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
         * is defined as O_NONBLOCK on some platforms and not on others.
         */
-       BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
-               O_RDONLY        | O_WRONLY      | O_RDWR        |
-               O_CREAT         | O_EXCL        | O_NOCTTY      |
-               O_TRUNC         | O_APPEND      | /* O_NONBLOCK | */
-               __O_SYNC        | O_DSYNC       | FASYNC        |
-               O_DIRECT        | O_LARGEFILE   | O_DIRECTORY   |
-               O_NOFOLLOW      | O_NOATIME     | O_CLOEXEC     |
-               __FMODE_EXEC    | O_PATH        | __O_TMPFILE   |
-               __FMODE_NONOTIFY
-               ));
+       BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ !=
+               HWEIGHT32(
+                       (VALID_OPEN_FLAGS & ~(O_NONBLOCK | O_NDELAY)) |
+                       __FMODE_EXEC | __FMODE_NONOTIFY));
 
        fasync_cache = kmem_cache_create("fasync_cache",
                sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);