Check FreeBSD upstream changes and apply important patches.

* sysv_sem.cc (__semctl): Check copyin return value (from 1.76).
	* sysv_shm.cc (shminit): Actually use the iterating variable in the
	for loop when trying to avoid overflow (from 1.102).
This commit is contained in:
Corinna Vinschen
2006-01-09 15:10:14 +00:00
parent 104fffd24d
commit e3786825c0
4 changed files with 12 additions and 2 deletions

View File

@@ -40,6 +40,7 @@
#define __FBSDID(s) const char version[] = (s)
#endif
__FBSDID("$FreeBSD: /repoman/r/ncvs/src/sys/kern/sysv_shm.c,v 1.89 2003/11/07 04:47:14 rwatson Exp $");
/* CV, 2006-01-09: Inspected upstream up to version 1.104. */
#define _KERNEL 1
#define __BSD_VISIBLE 1
@@ -954,7 +955,7 @@ shminit(void)
TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall);
for (i = PAGE_SIZE; i > 0; i--) {
shminfo.shmmax = shminfo.shmall * PAGE_SIZE;
shminfo.shmmax = shminfo.shmall * i;
if (shminfo.shmmax >= shminfo.shmall)
break;
}