summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2004-01-04 17:41:13 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-04 17:41:13 -0800
commit70faa195d4e1b6cddcc5c88987be1273eb8cab24 (patch)
treedcf6ad2aa8ce84dd92143094c00ae6fe12e6b31e
parente37d5b228334c3939b0447201a1870eb92a804ee (diff)
Don't allow mremap of zero-sized areas.
-rw-r--r--mm/mremap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 0412a204cb69..ce523ef85555 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -315,6 +315,10 @@ unsigned long do_mremap(unsigned long addr,
old_len = PAGE_ALIGN(old_len);
new_len = PAGE_ALIGN(new_len);
+ /* Don't allow the degenerate cases */
+ if (!(old_len | new_len))
+ goto out;
+
/* new_addr is only valid if MREMAP_FIXED is specified */
if (flags & MREMAP_FIXED) {
if (new_addr & ~PAGE_MASK)