]> Zhao Yanbai Git Server - minix.git/commitdiff
IPC: resolve Coverity warnings
authorDavid van Moolenbroek <david@minix3.org>
Tue, 7 Aug 2012 11:08:52 +0000 (13:08 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Wed, 8 Aug 2012 22:16:35 +0000 (00:16 +0200)
servers/ipc/sem.c

index 1212051ac218b8b2c007e754fa589c8dde000170..b723529a11a7f33d0902ddeba567dda11ce08565 100644 (file)
@@ -399,7 +399,7 @@ int do_semctl(message *m)
                        printf("SEMCTL: SETALL val: [%d] %d\n", i, buf[i]);
 #endif
                for (i = 0; i < sem->semid_ds.sem_nsems; i++) {
-                       if (buf[i] < 0 || buf[i] > SEMVMX) {
+                       if (buf[i] > SEMVMX) {
                                free(buf);
                                update_semaphores();
                                return ERANGE;
@@ -485,8 +485,7 @@ int do_semop(message *m)
        /* check for value range */
        r = EFBIG;
        for (i = 0; i < nsops; i++)
-               if (sops[i].sem_num < 0 ||
-                               sops[i].sem_num >= sem->semid_ds.sem_nsems)
+               if (sops[i].sem_num >= sem->semid_ds.sem_nsems)
                        goto out_free;
 
        /* check for duplicate number */