lkml.org 
[lkml]   [2002]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mmap.c corner case fix, per David S. Miller
    Hi Marcelo :)

This patch fixes the same corner case, but does something useful
even or architectures where TASK_SIZE is greater than SIZE_MAX-PAGE_SIZE

The patch is from David S. Miller, not me. My patch was
incomplete and did nothing on 'big TASK_SIZE' architectures, as
sparc64.

The patch is against both 2.4.20 and 2.4.21-pre1, is just the same.

Raúl
--- linux/mm/mmap.c.orig 2002-12-11 13:59:37.000000000 +0100
+++ linux/mm/mmap.c 2002-12-11 14:01:16.000000000 +0100
@@ -403,10 +403,12 @@
if (file && (!file->f_op || !file->f_op->mmap))
return -ENODEV;

- if ((len = PAGE_ALIGN(len)) == 0)
+ if (!len)
return addr;

- if (len > TASK_SIZE)
+ len = PAGE_ALIGN(len);
+
+ if (len > TASK_SIZE || len == 0)
return -EINVAL;

/* offset overflow? */
\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.033 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site