Kernel: use okendpt() to resolve stored endpoints
This adds an integrity check at very little cost, and should stop Coverity from flagging array overruns on the result.
This commit is contained in:
parent
c0aa9bf6ed
commit
0b5c2a058c
5 changed files with 5 additions and 5 deletions
|
@ -23,7 +23,7 @@ int do_iopenable(struct proc * caller, message * m_ptr)
|
|||
|
||||
#if 1 /* ENABLE_USERPRIV && ENABLE_USERIOPL */
|
||||
if (m_ptr->IOP_ENDPT == SELF) {
|
||||
proc_nr = _ENDPOINT_P(caller->p_endpoint);
|
||||
okendpt(caller->p_endpoint, &proc_nr);
|
||||
} else if(!isokendpt(m_ptr->IOP_ENDPT, &proc_nr))
|
||||
return(EINVAL);
|
||||
enable_iop(proc_addr(proc_nr));
|
||||
|
|
|
@ -54,7 +54,7 @@ int do_sdevio(struct proc * caller, message *m_ptr)
|
|||
* that initiated the device I/O. Kernel processes, of course, are denied.
|
||||
*/
|
||||
if (proc_nr_e == SELF)
|
||||
proc_nr = _ENDPOINT_P(caller->p_endpoint);
|
||||
okendpt(caller->p_endpoint, &proc_nr);
|
||||
else
|
||||
if(!isokendpt(proc_nr_e, &proc_nr))
|
||||
return(EINVAL);
|
||||
|
|
|
@ -44,7 +44,7 @@ int do_privctl(struct proc * caller, message * m_ptr)
|
|||
* forks.
|
||||
*/
|
||||
if (! (priv(caller)->s_flags & SYS_PROC)) return(EPERM);
|
||||
if(m_ptr->CTL_ENDPT == SELF) proc_nr = _ENDPOINT_P(caller->p_endpoint);
|
||||
if(m_ptr->CTL_ENDPT == SELF) okendpt(caller->p_endpoint, &proc_nr);
|
||||
else if(!isokendpt(m_ptr->CTL_ENDPT, &proc_nr)) return(EINVAL);
|
||||
rp = proc_addr(proc_nr);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ int do_schedule(struct proc * caller, message * m_ptr)
|
|||
if (!isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr))
|
||||
return EINVAL;
|
||||
|
||||
p = proc_addr(_ENDPOINT_P(m_ptr->SCHEDULING_ENDPOINT));
|
||||
p = proc_addr(proc_nr);
|
||||
|
||||
/* Only this process' scheduler can schedule it */
|
||||
if (caller != p->p_scheduler)
|
||||
|
|
|
@ -38,7 +38,7 @@ int do_umap_remote(struct proc * caller, message * m_ptr)
|
|||
|
||||
/* Verify process number. */
|
||||
if (endpt == SELF)
|
||||
proc_nr = _ENDPOINT_P(caller->p_endpoint);
|
||||
okendpt(caller->p_endpoint, &proc_nr);
|
||||
else
|
||||
if (! isokendpt(endpt, &proc_nr))
|
||||
return(EINVAL);
|
||||
|
|
Loading…
Reference in a new issue