Skip to content
Commit 75927af8 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds
Browse files

mm: madvise(): correct return code



The posix_madvise() function succeeds (and does nothing) when called with
parameters (NULL, 0, -1); according to LSB tests, it should fail with
EINVAL because -1 is not a valid flag.

When called with a valid address and size, it correctly fails.

So perform an initial check for valid flags first.

Reported-by: default avatarJiri Dluhos <jdluhos@novell.com>
Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Reviewed-and-Tested-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dab48dab
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment