linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] compr_lzo.c: allocate enough memory for lzo compressor.
@ 2008-04-11  9:33 Riku Voipio
  2008-04-11 10:52 ` Joakim Tjernlund
  2008-04-17 11:47 ` Artem Bityutskiy
  0 siblings, 2 replies; 4+ messages in thread
From: Riku Voipio @ 2008-04-11  9:33 UTC (permalink / raw)
  To: linux-mtd

This is the same bug as in kernel, pointed out the LZO author
(Markus Oberhumer):

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f2a11b158a24301e9158e9c873fa88e5eb775486
---
 compr_lzo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compr_lzo.c b/compr_lzo.c
index fb54600..a0bb362 100644
--- a/compr_lzo.c
+++ b/compr_lzo.c
@@ -97,7 +97,7 @@ int jffs2_lzo_init(void)
 		return -1;
 
 	/* Worse case LZO compression size from their FAQ */
-	lzo_compress_buf = malloc(page_size + (page_size / 64) + 16 + 3);
+	lzo_compress_buf = malloc(page_size + (page_size / 16) + 64 + 3);
 	if (!lzo_compress_buf) {
 		free(lzo_mem);
 		return -1;
-- 
1.5.4.5


-- 
"rm -rf" only sounds scary if you don't have backups

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] compr_lzo.c: allocate enough memory for lzo compressor.
  2008-04-11  9:33 [PATCH] compr_lzo.c: allocate enough memory for lzo compressor Riku Voipio
@ 2008-04-11 10:52 ` Joakim Tjernlund
  2008-04-11 11:07   ` Riku Voipio
  2008-04-17 11:47 ` Artem Bityutskiy
  1 sibling, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2008-04-11 10:52 UTC (permalink / raw)
  To: Riku Voipio; +Cc: linux-mtd


On Fri, 2008-04-11 at 12:33 +0300, Riku Voipio wrote:
> This is the same bug as in kernel, pointed out the LZO author
> (Markus Oberhumer):
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f2a11b158a24301e9158e9c873fa88e5eb775486
> ---
>  compr_lzo.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/compr_lzo.c b/compr_lzo.c
> index fb54600..a0bb362 100644
> --- a/compr_lzo.c
> +++ b/compr_lzo.c
> @@ -97,7 +97,7 @@ int jffs2_lzo_init(void)
>  		return -1;
>  
>  	/* Worse case LZO compression size from their FAQ */
> -	lzo_compress_buf = malloc(page_size + (page_size / 64) + 16 + 3);
> +	lzo_compress_buf = malloc(page_size + (page_size / 16) + 64 + 3);
>  	if (!lzo_compress_buf) {
>  		free(lzo_mem);
>  		return -1;

I think you should use lzo1x_worst_compress() from the link you posted
above.

  Jocke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] compr_lzo.c: allocate enough memory for lzo compressor.
  2008-04-11 10:52 ` Joakim Tjernlund
@ 2008-04-11 11:07   ` Riku Voipio
  0 siblings, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2008-04-11 11:07 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-mtd

On Fri, Apr 11, 2008 at 12:52:02PM +0200, Joakim Tjernlund wrote:
> 
> On Fri, 2008-04-11 at 12:33 +0300, Riku Voipio wrote:
> > This is the same bug as in kernel, pointed out the LZO author
> > (Markus Oberhumer):
> > 
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f2a11b158a24301e9158e9c873fa88e5eb775486
> > ---
> >  compr_lzo.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/compr_lzo.c b/compr_lzo.c
> > index fb54600..a0bb362 100644
> > --- a/compr_lzo.c
> > +++ b/compr_lzo.c
> > @@ -97,7 +97,7 @@ int jffs2_lzo_init(void)
> >  		return -1;
> >  
> >  	/* Worse case LZO compression size from their FAQ */
> > -	lzo_compress_buf = malloc(page_size + (page_size / 64) + 16 + 3);
> > +	lzo_compress_buf = malloc(page_size + (page_size / 16) + 64 + 3);
> >  	if (!lzo_compress_buf) {
> >  		free(lzo_mem);
> >  		return -1;

> I think you should use lzo1x_worst_compress() from the link you posted
> above.

lzo1x_worst_compress() is in the kernel header, while patch is for the
userland mtd-utils. The kernel header doesn't seem to get installed
with make headers_install, so I can't use it from userland. Also,
liblzo2 headers don't provide such function (although IMO they should).


-- 
"rm -rf" only sounds scary if you don't have backups

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] compr_lzo.c: allocate enough memory for lzo compressor.
  2008-04-11  9:33 [PATCH] compr_lzo.c: allocate enough memory for lzo compressor Riku Voipio
  2008-04-11 10:52 ` Joakim Tjernlund
@ 2008-04-17 11:47 ` Artem Bityutskiy
  1 sibling, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2008-04-17 11:47 UTC (permalink / raw)
  To: Riku Voipio; +Cc: linux-mtd


On Fri, 2008-04-11 at 12:33 +0300, Riku Voipio wrote:
> This is the same bug as in kernel, pointed out the LZO author
> (Markus Oberhumer):
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f2a11b158a24301e9158e9c873fa88e5eb775486
> ---
>  compr_lzo.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Both patches are pushed, thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-17 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11  9:33 [PATCH] compr_lzo.c: allocate enough memory for lzo compressor Riku Voipio
2008-04-11 10:52 ` Joakim Tjernlund
2008-04-11 11:07   ` Riku Voipio
2008-04-17 11:47 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).