From: Dan Carpenter Date: Wed, 17 Nov 2010 05:20:15 +0000 (-0300) Subject: [media] lirc_dev: fixes in lirc_dev_fop_read() X-Git-Tag: v2.6.37-rc8~21^2~3 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=250f7a5f62a08985af5cf7728ae7ba9edbfdc0a9;p=pandora-kernel.git [media] lirc_dev: fixes in lirc_dev_fop_read() This makes several changes but they're in one function and sort of related: "buf" was leaked on error. The leak if we try to read an invalid length is the main concern because it could be triggered over and over. If the copy_to_user() failed, then the original code returned the number of bytes remaining. read() is supposed to be the opposite way, where we return the number of bytes copied. I changed it to just return -EFAULT on errors. Also I changed the debug output from "-EFAULT" to just "" because it isn't -EFAULT necessarily. And since we go though that path if the length is invalid now, there was another debug print that I removed. Signed-off-by: Dan Carpenter Reviewed-by: Jarod Wilson Acked-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- Reading git-diff-tree failed