From: David van Moolenbroek Date: Tue, 7 Aug 2012 11:08:52 +0000 (+0200) Subject: IPC: resolve Coverity warnings X-Git-Tag: v3.2.1~399 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=fd8c6c1d30cdebabae60ef1a7e58b17c457e5d02;p=minix.git IPC: resolve Coverity warnings --- diff --git a/servers/ipc/sem.c b/servers/ipc/sem.c index 1212051ac..b723529a1 100644 --- a/servers/ipc/sem.c +++ b/servers/ipc/sem.c @@ -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 */