backout previous; (u_int) cast makes checks negative case too
This commit is contained in:
parent
b8e0e408a4
commit
61cb1d92bc
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_resource.c,v 1.66 2002/10/03 04:57:39 itojun Exp $ */
|
||||
/* $NetBSD: kern_resource.c,v 1.67 2002/10/03 05:18:59 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1991, 1993
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.66 2002/10/03 04:57:39 itojun Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.67 2002/10/03 05:18:59 itojun Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -251,7 +251,7 @@ dosetrlimit(p, cred, which, limp)
|
||||
struct plimit *newplim;
|
||||
int error;
|
||||
|
||||
if (which < 0 || (u_int)which >= RLIM_NLIMITS)
|
||||
if ((u_int)which >= RLIM_NLIMITS)
|
||||
return (EINVAL);
|
||||
|
||||
if (limp->rlim_cur < 0 || limp->rlim_max < 0)
|
||||
@ -369,7 +369,7 @@ sys_getrlimit(p, v, retval)
|
||||
} */ *uap = v;
|
||||
int which = SCARG(uap, which);
|
||||
|
||||
if (which < 0 || (u_int)which >= RLIM_NLIMITS)
|
||||
if ((u_int)which >= RLIM_NLIMITS)
|
||||
return (EINVAL);
|
||||
return (copyout(&p->p_rlimit[which], SCARG(uap, rlp),
|
||||
sizeof(struct rlimit)));
|
||||
|
Loading…
Reference in New Issue
Block a user