aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDima Dorfman <dd@FreeBSD.org>2001-09-11 12:19:15 +0000
committerDima Dorfman <dd@FreeBSD.org>2001-09-11 12:19:15 +0000
commit649d123e7017ca3b2bb6504de185fd0ac3f70484 (patch)
tree890dc67a23ad445263f453e18f77338e9b84396e
parentc5c73aa8c76c796ede453aac18ec08eab9a57fc0 (diff)
downloadsrc-649d123e7017ca3b2bb6504de185fd0ac3f70484.tar.gz
src-649d123e7017ca3b2bb6504de185fd0ac3f70484.zip
MFC 1.35: make semop()::nsops unsigned to prevent overflow.
Approved by: kris
Notes
Notes: svn path=/releng/4.3/; revision=83340
-rw-r--r--sys/kern/sysv_sem.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index f616f6eeb656..4b9854dcde0a 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -672,7 +672,7 @@ found:
struct semop_args {
int semid;
struct sembuf *sops;
- int nsops;
+ u_int nsops;
};
#endif
@@ -682,7 +682,7 @@ semop(p, uap)
register struct semop_args *uap;
{
int semid = uap->semid;
- int nsops = uap->nsops;
+ u_int nsops = uap->nsops;
struct sembuf sops[MAX_SOPS];
register struct semid_ds *semaptr;
register struct sembuf *sopptr;
@@ -692,7 +692,7 @@ semop(p, uap)
int do_wakeup, do_undos;
#ifdef SEM_DEBUG
- printf("call to semop(%d, 0x%x, %d)\n", semid, sops, nsops);
+ printf("call to semop(%d, 0x%x, %u)\n", semid, sops, nsops);
#endif
if (!jail_sysvipc_allowed && p->p_prison != NULL)
@@ -718,14 +718,14 @@ semop(p, uap)
if (nsops > MAX_SOPS) {
#ifdef SEM_DEBUG
- printf("too many sops (max=%d, nsops=%d)\n", MAX_SOPS, nsops);
+ printf("too many sops (max=%d, nsops=%u)\n", MAX_SOPS, nsops);
#endif
return(E2BIG);
}
if ((eval = copyin(uap->sops, &sops, nsops * sizeof(sops[0]))) != 0) {
#ifdef SEM_DEBUG
- printf("eval = %d from copyin(%08x, %08x, %d)\n", eval,
+ printf("eval = %d from copyin(%08x, %08x, %u)\n", eval,
uap->sops, &sops, nsops * sizeof(sops[0]));
#endif
return(eval);