linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmap.c (do_mmap_pgoff), against 2.4.19 and 2.4.20-pre10
@ 2002-10-14  9:36 DervishD
  2002-10-14  9:52 ` David S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: DervishD @ 2002-10-14  9:36 UTC (permalink / raw)
  To: Linux-kernel; +Cc: Marcelo Tosatti

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

    Hi all, specially Marcelo :)

    This is the fourth and last time I submit this patch to Marcelo.
This little tiny bug is fixed in all trees except the official one. I
think this patch is trivial enough to be accepted, but...

    Well, the attachments included (unified diff format), is the patch
against both 2.4.19 and 2.4.20-pre10 (I've changed the kernel name
directory part to '/usr/src/linux/' so it's applicable to both
versions.

    Marcelo, if you don't want to include this patch at least let me
know, please, so I won't need to see each new prerelease for seeing
if the patch has been already included ;))) Don't take it bad.

    Raúl

[-- Attachment #2: mmap.c.diff --]
[-- Type: text/plain, Size: 824 bytes --]

--- /usr/src/linux/mm/mmap.c.orig	2002-10-14 11:16:40.000000000 +0200
+++ /usr/src/linux/kernel/mm/mmap.c	2002-10-14 11:19:32.000000000 +0200
@@ -390,6 +390,12 @@
 	return 0;
 }
 
+
+/*
+ *	NOTE: in this function we rely on TASK_SIZE being lower than
+ *	SIZE_MAX-PAGE_SIZE at least. I'm pretty sure that it is.
+ */
+
 unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
 	unsigned long prot, unsigned long flags, unsigned long pgoff)
 {
@@ -403,12 +409,14 @@
 	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)
 		return -EINVAL;
 
+	len = PAGE_ALIGN(len);  /* This cannot be zero now */
+
 	/* offset overflow? */
 	if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
 		return -EINVAL;

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-10-15  8:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14  9:36 [PATCH] mmap.c (do_mmap_pgoff), against 2.4.19 and 2.4.20-pre10 DervishD
2002-10-14  9:52 ` David S. Miller
2002-10-14 10:20   ` DervishD
2002-10-14 10:44     ` David S. Miller
2002-10-14 11:04       ` DervishD
2002-10-14 10:09 ` Russell King
2002-10-14 10:25   ` DervishD
2002-10-14 20:26 ` Marcelo Tosatti
2002-10-15  7:37   ` DervishD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).