Re: [PATCH] kernel/itimer.c: for return value, using -EINVAL insteadof -EFAULT

From: Chen Gang
Date: Thu Jun 20 2013 - 04:17:38 EST


On 06/20/2013 03:44 PM, Thomas Gleixner wrote:
> We could do that, but that makes no sense. If we can detect it before
> copy_to_user() we can return the exactly same return value which we
> would return via copy_to_user(). That avoids to take a trap and run
> through the fixup code

I don't think "that makes no sense".

In most cases, the 'value' will not be NULL, so it is better for
performance (save one compare instruction, at least).

Also, it will make the code simpler and clearer for readers.



Thanks.
--
Chen Gang

Asianux Corporation
--
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/