diff options
author | alc <alc@FreeBSD.org> | 2002-06-20 18:38:28 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-06-20 18:38:28 +0000 |
commit | c2afd32ef72eac57b98d33e52cb7d01c26da2dce (patch) | |
tree | b2cd086601bad8bcc80b76b9594edbec99b41791 /sys/vm/vm_unix.c | |
parent | 4f8d67f85285bf07b2b7e42c3ab9c3bece0ada97 (diff) | |
download | FreeBSD-src-c2afd32ef72eac57b98d33e52cb7d01c26da2dce.zip FreeBSD-src-c2afd32ef72eac57b98d33e52cb7d01c26da2dce.tar.gz |
o Remove an incorrect cast from obreak(). This cast would,
for example, break an sbrk(>=4GB) on 64-bit architectures
even if the resource limit allowed it.
o Correct an off-by-one error.
o Correct a spelling error in a comment.
o Reorder an && expression so that the commonly FALSE expression
comes first.
Submitted by: bde (bullets 1 and 2)
Diffstat (limited to 'sys/vm/vm_unix.c')
-rw-r--r-- | sys/vm/vm_unix.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index 6fcd2c5..bf932fd 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -85,15 +85,15 @@ obreak(td, uap) old = base + ctob(vm->vm_dsize); if (new > base) { /* - * We check resource limits here, but alow processes to - * reduce their usage, even if they remain over the limit. + * Check the resource limit, but allow a process to reduce + * its usage, even if it remains over the limit. */ - if (new > old && - (new - base) > (unsigned) td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur) { + if (new - base > td->td_proc->p_rlimit[RLIMIT_DATA].rlim_cur && + new > old) { error = ENOMEM; goto done; } - if (new >= VM_MAXUSER_ADDRESS) { + if (new > VM_MAXUSER_ADDRESS) { error = ENOMEM; goto done; } |