summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Jennings <sjenning@linux.vnet.ibm.com>2012-02-28 16:01:37 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-29 15:23:37 -0800
commit843c666d16e62e4b3889f1491a1d91b87ddc7bd3 (patch)
tree5ffa899b3cbae99b3f9f9d36c371462dd0dae822
parent0339d3dbbfd51348dda584796e59a740a57a7e32 (diff)
staging: zcache: fix length type mismatch
This fixes a type mismatch in the compression code where a size_t pointer was cast to a unsigned int pointer. On little endian archs, there is no issue. However on big endian archs, the value is incorrect, taking the high order bits and truncating the lower order bits. Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/zcache/zcache-main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 238d82095ab1..46c7c04c2451 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -1170,14 +1170,14 @@ static atomic_t zcache_curr_pers_pampd_count = ATOMIC_INIT(0);
static unsigned long zcache_curr_pers_pampd_count_max;
/* forward reference */
-static int zcache_compress(struct page *from, void **out_va, size_t *out_len);
+static int zcache_compress(struct page *from, void **out_va, unsigned *out_len);
static void *zcache_pampd_create(char *data, size_t size, bool raw, int eph,
struct tmem_pool *pool, struct tmem_oid *oid,
uint32_t index)
{
void *pampd = NULL, *cdata;
- size_t clen;
+ unsigned clen;
int ret;
unsigned long count;
struct page *page = (struct page *)(data);
@@ -1326,7 +1326,7 @@ static struct tmem_pamops zcache_pamops = {
static DEFINE_PER_CPU(unsigned char *, zcache_dstmem);
#define ZCACHE_DSTMEM_ORDER 1
-static int zcache_compress(struct page *from, void **out_va, size_t *out_len)
+static int zcache_compress(struct page *from, void **out_va, unsigned *out_len)
{
int ret = 0;
unsigned char *dmem = __get_cpu_var(zcache_dstmem);
@@ -1339,7 +1339,7 @@ static int zcache_compress(struct page *from, void **out_va, size_t *out_len)
from_va = kmap_atomic(from, KM_USER0);
mb();
ret = zcache_comp_op(ZCACHE_COMPOP_COMPRESS, from_va, PAGE_SIZE, dmem,
- (unsigned int *)out_len);
+ out_len);
BUG_ON(ret);
*out_va = dmem;
kunmap_atomic(from_va, KM_USER0);