]> bbs.cooldavid.org Git - net-next-2.6.git/commit
kfifo: sanitize *_user error handling
authorAndi Kleen <andi@firstfloor.org>
Sat, 16 Jan 2010 01:01:15 +0000 (17:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Jan 2010 20:15:38 +0000 (12:15 -0800)
commit64ce1037c5434b1d036cd99ecaee6e00496bc2e9
tree37a8c8f1dccdcdb3d00bf07d36d86fe6ea05f3f9
parent8ecc2951534af10e04ddb5e5ff5c6d217b79f5c2
kfifo: sanitize *_user error handling

Right now for kfifo_*_user it's not easily possible to distingush between
a user copy failing and the FIFO not containing enough data.  The problem
is that both conditions are multiplexed into the same return code.

Avoid this by moving the "copy length" into a separate output parameter
and only return 0/-EFAULT in the main return value.

I didn't fully adapt the weird "record" variants, those seem
to be unused anyways and were rather messy (should they be just removed?)

I would appreciate some double checking if I did all the conversions
correctly.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Stefani Seibold <stefani@seibold.net>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andy Walls <awalls@radix.net>
Cc: Vikram Dhillon <dhillonv10@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/kfifo.h
kernel/kfifo.c