All of lore.kernel.org
 help / color / mirror / Atom feed
* [TRIVIAL] mmap.c corner case fix
@ 2003-01-09 14:56 DervishD
  0 siblings, 0 replies; only message in thread
From: DervishD @ 2003-01-09 14:56 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Linux-kernel

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

    Hi Marcelo :)

    This patch fixes a corner case on the mmap() syscall.

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

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

    Raúl

[-- Attachment #2: mmap.c.diff for 2.4.20 and 2.4.21-pre --]
[-- Type: text/plain, Size: 407 bytes --]

--- 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? */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-01-09 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-09 14:56 [TRIVIAL] mmap.c corner case fix DervishD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.