public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gianni Tedesco <gianni@ecsc.co.uk>
To: linux-kernel@vger.kernel.org
Subject: [PATCH]: trivial sys_mincore cleanup
Date: 20 Dec 2002 11:17:54 +0000	[thread overview]
Message-ID: <1040383074.12106.30.camel@lemsip> (raw)

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

Patch makes 2 simple cleanups:
 - Checks the syscall parameters before grabbing mmap semaphore.
 - Tidy up a comment.

BTW. How comes mincore() doesn't return a bit vector? :P

diff -urN linux-2.4.19.orig/mm/filemap.c linux-2.4.19/mm/filemap.c
--- linux-2.4.19.orig/mm/filemap.c      Sat Aug  3 00:39:46 2002
+++ linux-2.4.19/mm/filemap.c   Fri Dec 20 11:11:56 2002
@@ -2736,21 +2736,21 @@
        int unmapped_error = 0;
        long error = -EINVAL;
 
-       down_read(&current->mm->mmap_sem);
-
        if (start & ~PAGE_CACHE_MASK)
-               goto out;
+               return error;
        len = (len + ~PAGE_CACHE_MASK) & PAGE_CACHE_MASK;
        end = start + len;
        if (end < start)
-               goto out;
+               return error;
 
        error = 0;
        if (end == start)
-               goto out;
+               return error;
+
+       down_read(&current->mm->mmap_sem);
 
        /*
-        * If the interval [start,end) covers some unmapped address
+        * If the interval [start,end] covers some unmapped address
         * ranges, just ignore them, but return -ENOMEM at the end.
         */
        vma = find_vma(current->mm, start);

-- 
// Gianni Tedesco (gianni at ecsc dot co dot uk)
lynx --source www.scaramanga.co.uk/gianni-at-ecsc.asc | gpg --import
8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 232 bytes --]

             reply	other threads:[~2002-12-20 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 11:17 Gianni Tedesco [this message]
2002-12-31  9:23 ` [PATCH]: trivial sys_mincore cleanup Alex Riesen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1040383074.12106.30.camel@lemsip \
    --to=gianni@ecsc.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox