* [BUG] in do_mmap_pgoff() (2.4.19-preX)
@ 2002-06-16 19:16 Abhishek Nayani
2002-06-19 12:25 ` Rik van Riel
0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Nayani @ 2002-06-16 19:16 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel
Hi,
While documenting the do_mmap_pgoff() function, i found this
snippet of code very suspicious:
/* Private writable mapping? Check memory availability.. */
if ((vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE &&
!(flags & MAP_NORESERVE) &&
!vm_enough_memory(len >> PAGE_SHIFT))
return -ENOMEM;
Here we need to quit if *any* one of the condition is true. So I
think it should be "||" instead of "&&". As according to the present
code, it quits only if all the 3 conditions is true, which is wrong.
Bye,
Abhi.
Linux Kernel Documentation Project
http://freesoftware.fsf.org/lkdp
--------------------------------------------------------------------------------
Those who cannot remember the past are condemned to repeat it - George Santayana
--------------------------------------------------------------------------------
Home Page: http://www.abhi.tk
-----BEGIN GEEK CODE BLOCK------------------------------------------------------
GCS d+ s:- a-- C+++ UL P+ L+++ E- W++ N+ o K- w--- O-- M- V- PS PE Y PGP
t+ 5 X+ R- tv+ b+++ DI+ D G e++ h! !r y-
------END GEEK CODE BLOCK-------------------------------------------------------
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] in do_mmap_pgoff() (2.4.19-preX)
2002-06-16 19:16 [BUG] in do_mmap_pgoff() (2.4.19-preX) Abhishek Nayani
@ 2002-06-19 12:25 ` Rik van Riel
0 siblings, 0 replies; 2+ messages in thread
From: Rik van Riel @ 2002-06-19 12:25 UTC (permalink / raw)
To: Abhishek Nayani; +Cc: linux-mm, linux-kernel
On Mon, 17 Jun 2002, Abhishek Nayani wrote:
> While documenting the do_mmap_pgoff() function, i found this
> snippet of code very suspicious:
>
> /* Private writable mapping? Check memory availability.. */
> if ((vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE &&
> !(flags & MAP_NORESERVE) &&
> !vm_enough_memory(len >> PAGE_SHIFT))
> return -ENOMEM;
>
> Here we need to quit if *any* one of the condition is true. So I
> think it should be "||" instead of "&&". As according to the present
> code, it quits only if all the 3 conditions is true, which is wrong.
No, the code is correct.
The only case where we end up allocating new pages for
this mapping is when the mapping is both writable and
private.
Read-only mappings and shared mappings always have backing
store, the file from which the mapping comes and empty_zero_page.
regards,
Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/ http://distro.conectiva.com/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-06-19 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-16 19:16 [BUG] in do_mmap_pgoff() (2.4.19-preX) Abhishek Nayani
2002-06-19 12:25 ` Rik van Riel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox