projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
00e81df
)
Don't read anything from the disk for a segment with p_filesz == 0.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 8 Apr 2006 18:34:47 +0000
(18:34 +0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 8 Apr 2006 18:34:47 +0000
(18:34 +0000)
Thanks to Godmar Back for reporting this bug.
src/userprog/process.c
patch
|
blob
|
history
diff --git
a/src/userprog/process.c
b/src/userprog/process.c
index a81ca590fea187321197c699950df0e38cdbc40f..8c410aba98519a273d5d7a60155468f5b4ffc556 100644
(file)
--- a/
src/userprog/process.c
+++ b/
src/userprog/process.c
@@
-333,7
+333,9
@@
load_segment (struct file *file, const struct Elf32_Phdr *phdr)
return false;
/* Load the segment page-by-page into memory. */
- filesz_left = phdr->p_filesz + (phdr->p_vaddr & PGMASK);
+ filesz_left = phdr->p_filesz;
+ if (filesz_left > 0)
+ filesz_left += phdr->p_vaddr & PGMASK;
file_seek (file, ROUND_DOWN (phdr->p_offset, PGSIZE));
for (upage = start; upage < (uint8_t *) end; upage += PGSIZE)
{