Displaying 2 results from an estimated 2 matches for "lzo1x_worst_compress".
2013 Feb 15
1
[PATCH] btrfs: use kmalloc for lzo de/compress buffer
...kfree(workspace->mem);
kfree(workspace);
}
@@ -54,9 +53,10 @@ static struct list_head *lzo_alloc_workspace(void)
if (!workspace)
return ERR_PTR(-ENOMEM);
- workspace->mem = vmalloc(LZO1X_MEM_COMPRESS);
- workspace->buf = vmalloc(PAGE_CACHE_SIZE);
- workspace->cbuf = vmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE));
+ workspace->mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_NOFS);
+ workspace->buf = kmalloc(PAGE_CACHE_SIZE, GFP_NOFS);
+ workspace->cbuf = kmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE),
+ GFP_NOFS);
if (!workspace->mem || !workspace->buf || !workspace->cbuf)
go...
2011 Nov 11
0
[PATCH 9/9] Decompressors: check input size in unlzo.c
...u8 *output, unsigned int *posp,
void (*error) (const char *x))
{
- u8 skip = 0, r = 0;
+ u8 r = 0;
+ int skip = 0;
u32 src_len, dst_len;
size_t tmp;
u8 *in_buf, *in_buf_save, *out_buf;
@@ -149,19 +172,25 @@ STATIC int INIT unlzo(u8 *input, unsigne
if (fill)
fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE));
- if (!parse_header(input, &skip)) {
+ if (!parse_header(input, &skip, in_len)) {
error("invalid header");
goto exit_2;
}
in_buf += skip;
+ in_len -= skip;
if (posp)
*posp = skip;
for (;;) {
/* read uncompressed block size */
+ if (in_l...