lzo: Add some missing casts
PATCH 1/1 lzo: Add some missing casts
Add some casts to the LZO compression algorithm after they were removed during cleanup and shouldn't have been.
---
This fixes the reported problems for me, I've checked fairly carefully and I can't see any other issues. Edward, could you see if this resolves the problems in your case please?
lib/lzo/lzo1x_compress.c +3 -3
@@ -32,13 +32,13 @@ _lzo1x_1_do_compress(const unsigned char ip +=4 ;for (;;) { - dindex = ((0x21 *DX3 (ip,5 ,5 ,6 )) >>5 ) &D_MASK ; + dindex = ((size_t )(0x21 *DX3 (ip,5 ,5 ,6 )) >>5 ) &D_MASK ; m_pos = dict[dindex];if (m_pos < in) goto literal; -if (ip == m_pos || (ip - m_pos) >M4_MAX_OFFSET ) +if (ip == m_pos || ((size_t )(ip - m_pos) >M4_MAX_OFFSET )) goto literal; m_off = ip - m_pos;
@@ -51,7 +51,7 @@ _lzo1x_1_do_compress(const unsigned charif (m_pos < in) goto literal; -if (ip == m_pos || (ip - m_pos) >M4_MAX_OFFSET ) +if (ip == m_pos || ((size_t )(ip - m_pos) >M4_MAX_OFFSET )) goto literal; m_off = ip - m_pos;
PATCH 1/1 reiser4: use lzo library functions
Richard Purdie wrote:
...
Quoted 3 lines
Edward, could you see if this resolves
the problems in your case please?
Yes, with this fixup everything looks okay, thanks.
And this is a port of reiser4 to the new library.
Edward.
. Convert Reiser4 to use lzo implementation in lib/lzo/ instead of
including its own copy of minilzo;
. Do not set zeros to workmem region.
--- linux-2.6.23-rc1-mm1/fs/reiser4/Kconfig | 2 linux-2.6.23-rc1-mm1/fs/reiser4/Makefile | 1 linux-2.6.23-rc1-mm1/fs/reiser4/plugin/compress/Makefile | 1 linux-2.6.23-rc1-mm1/fs/reiser4/plugin/compress/compress.c | 24 linux-2.6.23-rc1-mm1/fs/reiser4/plugin/compress/lzoconf.h | 216 - linux-2.6.23-rc1-mm1/fs/reiser4/plugin/compress/minilzo.c | 1967 ------------- linux-2.6.23-rc1-mm1/fs/reiser4/plugin/compress/minilzo.h | 70 7 files changed, 7 insertions(+), 2274 deletions(-)
fs/reiser4/Kconfig renamed from fs/reiser4/Kconfig.orig +2 -0
@@ -3,6 +3,8 @@ depends on EXPERIMENTAL select ZLIB_INFLATE select ZLIB_DEFLATE + select LZO_COMPRESS + select LZO_DECOMPRESS select CRYPTO help Reiser4 is a filesystem that performs all filesystem operations
fs/reiser4/Makefile renamed from fs/reiser4/Makefile.orig +0 -1
@@ -70,7 +70,6 @@ plugin/crypto/cipher.o \ plugin/crypto/digest.o \ \ - plugin/compress/minilzo.o \ plugin/compress/compress.o \ plugin/compress/compress_mode.o \ \
fs/reiser4/plugin/compress/Makefile renamed from fs/reiser4/plugin/compress/Makefile.orig +0 -1
@@ -2,5 +2,4 @@ compress_plugins-objs := \ compress.o \ - minilzo.o \ compress_mode.o
fs/reiser4/plugin/compress/compress.c renamed from fs/reiser4/plugin/compress/compress.c.orig +5 -19
@@ -4,8 +4,8 @@#include "../../debug.h" #include "../../inode.h" #include "../plugin.h" -#include "minilzo.h" +#include <linux/lzo.h> #include <linux/zlib.h> #include <linux/types.h> #include <linux/hardirq.h>
@@ -77,7 +77,6 @@ ret = -ENOMEM ;break ; } -memset (coa,0 ,zlib_deflate_workspacesize ());break ;case TFMA_READ :/* decompress */ coa =reiser4_vmalloc (zlib_inflate_workspacesize ());
@@ -85,7 +84,6 @@ ret = -ENOMEM ;break ; } -memset (coa,0 ,zlib_inflate_workspacesize ());break ;default : impossible("edward-767",
@@ -131,8 +129,6 @@int ret =0 ;struct z_stream_s stream; -memset (&stream,0 ,sizeof (stream)); -assert ("edward-842" , coa !=NULL );assert ("edward-875" , src_len !=0 );
@@ -177,8 +173,6 @@int ret =0 ;struct z_stream_s stream; -memset (&stream,0 ,sizeof (stream)); -assert ("edward-843" , coa !=NULL );assert ("edward-876" , src_len !=0 );
@@ -226,11 +220,7 @@static int lzo1_init (void ) { -int ret; - ret =lzo_init (); -if (ret !=LZO_E_OK ) -warning ("edward-848" ,"lzo_init() failed with ret = %d\n" , ret); -return ret; +return 0 ; }static int lzo1_overrun (unsigned in_len)
@@ -238,9 +228,6 @@return in_len /64 +16 +3 ; } -#define LZO_HEAP_SIZE (size) \ - sizeof(lzo_align_t) * (((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t)) -static coa_t lzo1_alloc (tfm_action act) {int ret =0 ;
@@ -248,12 +235,11 @@switch (act) {case TFMA_WRITE :/* compress */ - coa =reiser4_vmalloc (LZO_HEAP_SIZE (LZO1X_1_MEM_COMPRESS )); + coa =reiser4_vmalloc (LZO1X_1_MEM_COMPRESS );if (!coa) { ret = -ENOMEM ;break ; } -memset (coa,0 ,LZO_HEAP_SIZE (LZO1X_1_MEM_COMPRESS ));case TFMA_READ :/* decompress */ break ;default :
@@ -301,7 +287,7 @@assert ("edward-847" , src_len !=0 ); result =lzo1x_1_compress (src_first, src_len, dst_first, dst_len, coa); -if (result !=LZO_E_OK ) { +if (unlikely (result !=LZO_E_OK )) {warning ("edward-849" ,"lzo1x_1_compress failed\n" ); goto out; }
@@ -324,7 +310,7 @@assert ("edward-851" , coa ==NULL );assert ("edward-852" , src_len !=0 ); - result =lzo1x_decompress (src_first, src_len, dst_first, dst_len,NULL ); + result =lzo1x_decompress_safe (src_first, src_len, dst_first, dst_len);if (result !=LZO_E_OK )warning ("edward-853" ,"lzo1x_1_decompress failed\n" );return ;
fs/reiser4/plugin/compress/lzoconf.h deleted +0 -216
216 lines not on this page · raw message
fs/reiser4/plugin/compress/minilzo.c deleted +0 -1967
1,967 lines not on this page · raw message
fs/reiser4/plugin/compress/minilzo.h deleted +0 -70
70 lines not on this page · raw message