staging: ramster: fix range checks in zcache_autocreate_pool()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 6 Sep 2012 12:40:20 +0000 (15:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Sep 2012 16:25:22 +0000 (09:25 -0700)
commitf0290de23de19b592b2934cdf21c0c0c2eb16500
tree023beca4851a086625c2f8b404ee85a23e6cad75
parentd08d6cfe3b594b797e1204891613d1cdf70fb0c7
staging: ramster: fix range checks in zcache_autocreate_pool()

If "pool_id" is negative then it leads to a read before the start of the
array.  If "cli_id" is out of bounds then it leads to a NULL dereference
of "cli".  GCC would have warned about that bug except that we
initialized the warning message away.

Also it's better to put the parameter names into the function
declaration in the .h file.  It serves as a kind of documentation.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ramster/zcache-main.c
drivers/staging/ramster/zcache.h