Re: [PATCH 0/2] sys_write() should write all valid data

From: Vitaly Mayatskikh
Date: Thu May 14 2009 - 14:48:36 EST


At Thu, 14 May 2009 14:02:34 -0400, Josef Bacik wrote:

> Ok all in all I don't think this is a good way to handle this problem.
> Hopefully somebody smarter than I will speak up, but what you are trying to do
> here is have your cake and eat it too. You want to get the size of what we were
> able to fault in and return that, which should be a size_t,

btw, fault_in_pages_readable() has argument `size' of type int...

> but you also want to
> throw back an error if something happened, which needs a signed value. I think
> the best way to handle this would be to make check_readable_bytes return size_t,
> and then if you get an EFAULT back, have it return 0. Then the caller can say
> "hey I couldn't fault anything in, let me make what I want to fault in smaller",
> and then if that fault returns 0 we can exit.

Won't it be suboptimal to trap in the same place twice?

> I hope thats helpful/correct :).

--
wbr, Vitaly
--
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/