Re: mincore returning -ENOMEM instead of -EFAULT

From: Linus Torvalds
Date: Sun Feb 25 2007 - 18:06:56 EST




On Fri, 23 Feb 2007, Joel Becker wrote:
>
> Your fix in commit 2f77d107050abc14bc393b34bdb7b91cf670c250
> modifies sys_mincore() to return -ENOMEM instead of -EFAULT on a totally
> bogus address. Was this intentional, or is it something that should be
> fixed up?

It was intentional, and I don't actually think it was even a change. The
access_ok() in question is not done on the actual array that we fill up
with the result of the operation, but on the address range that is being
queried, and if the queried address range is bogus, we should return
ENOMEM.

It's even mentioned in the man-page..

We *do* return -EFAULT for the case where the "vec" array itself is not
mapped.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/