Skip to contentSkip to conversation

: trivial sys_mincore cleanup

PATCH In review Gianni Tedesco 2 participants 2 messages Dec 20, 2002 – Dec 31, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : trivial sys_mincore cleanup

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

mm/filemap.c Fri Dec 20 11:11:56 2002 renamed from mm/filemap.c Sat Aug 3 00:39:46 2002 +6 -6
diff -urN linux-2.4.19.orig/mm/filemap.c linux-2.4.19/mm/filemap.c
@@ -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);
Signature · 3 lines
// 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
#1 lore raw

Gianni Tedesco, Fri, Dec 20, 2002 12:17:54 +0100:

Quoted 3 lines

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

The comment is actually right: it is an old mathematical notation to describe regions - from start until end, but not including the end.

mm/filemap.c Fri Dec 20 11:11:56 2002 line 2755

Quoted 5 lines
        /*
mm/filemap.c Fri Dec 20 11:11:56 2002 renamed from mm/filemap.c Sat Aug 3 00:39:46 2002 +1 -1
-        * 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.
         */

-alex