linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmap.c (do_mmap_pgoff) against 2.4.19/2.4.20-pre10, better format.
@ 2002-10-14 11:07 DervishD
  0 siblings, 0 replies; only message in thread
From: DervishD @ 2002-10-14 11:07 UTC (permalink / raw)
  To: Linux-kernel

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

    Hi all :))

    This time the patch is 'good looking', as per the warning Russell
issued over the format of the last patch (Thanks Russell ;)))

    Raúl

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

--- linux/mm/mmap.c.orig  2002-10-14 11:16:40.000000000 +0200
+++ linux/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] only message in thread

only message in thread, other threads:[~2002-10-14 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14 11:07 [PATCH] mmap.c (do_mmap_pgoff) against 2.4.19/2.4.20-pre10, better format 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).