diff options
author | Frans Kaashoek <[email protected]> | 2022-08-12 14:59:30 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2022-08-12 14:59:30 -0400 |
commit | 7a6d57235c41df877b3fb2322cf770e65e864058 (patch) | |
tree | 9d9ffa50dbaa47d73987128751c3c56beedb4ea7 /kernel/syscall.c | |
parent | 8f58cc7df99e9f697ca3843886802ecab5cb8991 (diff) | |
download | xv6-labs-7a6d57235c41df877b3fb2322cf770e65e864058.tar.gz xv6-labs-7a6d57235c41df877b3fb2322cf770e65e864058.tar.bz2 xv6-labs-7a6d57235c41df877b3fb2322cf770e65e864058.zip |
Costmestic change (thanks Harry Porter)
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r-- | kernel/syscall.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/syscall.c b/kernel/syscall.c index 95b9f70..dd7a33e 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -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); } |