Costmestic change (thanks Harry Porter)
This commit is contained in:
parent
8f58cc7df9
commit
7a6d57235c
|
@ -12,7 +12,7 @@ int
|
|||
fetchaddr(uint64 addr, uint64 *ip)
|
||||
{
|
||||
struct proc *p = myproc();
|
||||
if(addr >= p->sz || addr+sizeof(uint64) > p->sz)
|
||||
if(addr >= p->sz || addr+sizeof(uint64) > p->sz) // both tests needed, in case of overflow
|
||||
return -1;
|
||||
if(copyin(p->pagetable, (char *)ip, addr, sizeof(*ip)) != 0)
|
||||
return -1;
|
||||
|
@ -25,9 +25,8 @@ int
|
|||
fetchstr(uint64 addr, char *buf, int max)
|
||||
{
|
||||
struct proc *p = myproc();
|
||||
int err = copyinstr(p->pagetable, buf, addr, max);
|
||||
if(err < 0)
|
||||
return err;
|
||||
if(copyinstr(p->pagetable, buf, addr, max) < 0)
|
||||
return -1;
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue