From: "Nitin Gupta" <nitingupta910@gmail.com>
To: "Heikki Orsila" <shdl@zakalwe.fi>
Cc: linux-kernel@vger.kernel.org,
"Richard Purdie" <richard@openedhand.com>,
"Markus F.X.J. Oberhumer" <markus@oberhumer.com>
Subject: Re: [RFC] LZO1X de/compression support
Date: Fri, 18 May 2007 16:57:25 +0530 [thread overview]
Message-ID: <4cefeab80705180427u54110396mfb3acd96c6c446bd@mail.gmail.com> (raw)
In-Reply-To: <20070518101449.GH10873@zakalwe.fi>
Hi,
Thanks for review. My comments inline.
On 5/18/07, Heikki Orsila <shdl@zakalwe.fi> wrote:
> Good work..
>
> On Fri, May 18, 2007 at 03:28:31PM +0530, Nitin Gupta wrote:
> > Facts for LZO (at least for original code. Should hold true for this
> > port also - hence the RFC!):
> > - The compressor can never overrun buffer.
> > - The "non-safe" version of decompressor can never overrun buffer if
> > compressed data is unmodified. I am not sure about this if compressed
> > data is malicious (to be confirmed from the author).
> > - The "safe" version can never crash (buffer overrun etc.) - confirmed
> > from the author.
>
> What's the proof?
I confirmned these from the author - I just ported this code. I think
he can answer you better - CC'ed him :-)
>
> > +/* LZO1X_1 compression */
> > +int
> > +lzo1x_compress(const unsigned char *src, size_t src_len,
> > + unsigned char *dst, size_t *dst_len,
> > + void *workmem);
>
> int lzo1x_compress(const unsigned char *src, size_t src_len,
> unsigned char *dst, size_t *dst_len,
> void *workmem);
>
> is the preferred style.
>
OK. Changed.
<snip>
> > + register const unsigned char *ip;
>
> Is the register directive really useful? Or any subsequent usage of that
> directive?
The author must be having some performance gain with this directive.
Though I didn't test performance changes with/without this directive.
> > + DINDEX1(dindex,ip);
>
> Put a space after the delimiter: DINDEX1(dindex, ip); This happens in
> many places in the source, fix them all.
OK.
> Useless brackets: (unsigned char) tt
>
OK.
> > + }
> > + do *op++ = *ii++; while (--t > 0);
>
> memcpy(op, ii, t); ? Happens in other places as well.
I looked more carefully into such cases. Following type of code blocks
are repeated at several places:
---
COPY4(op,ip);
op += 4;
ip += 4;
if (--t > 0) {
if (t >= 4) {
do {
COPY4(op,ip);
op += 4; ip += 4; t -= 4;
} while (t >= 4);
if (t > 0)
do
*op++ = *ip++;
while (--t > 0);
} else
do
*op++ = *ip++;
while (--t > 0);
}
---
Such entire blocks can be replaced by simple:
memcpy(op, ip, t + 4);
Since kernel has separate memcpy() implementation optimized for
specific archs, we shouldn't loose on perf while having simpler (and
shorter) code.
I will work on this and post again.
> > +#define COPY4(dst,src) *(uint32_t *)(dst) = *(uint32_t *)(src)
>
> Use u32.
>
What is the problem with uint32_t? Anyhow, I think COPY4 will
disappear after those memcpy changes :)
Thanks for comments. I will post revised patch soon.
Cheers,
Nitin
next prev parent reply other threads:[~2007-05-18 11:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-18 9:58 Nitin Gupta
2007-05-18 10:14 ` Heikki Orsila
2007-05-18 11:27 ` Nitin Gupta [this message]
2007-05-18 11:53 ` Richard Purdie
2007-05-18 10:42 ` Pekka Enberg
2007-05-18 10:53 ` Pekka Enberg
2007-05-22 8:54 ` Nitin Gupta
2007-05-22 8:59 ` Pekka Enberg
2007-05-22 9:10 ` Nitin Gupta
2007-05-22 9:34 ` Pekka Enberg
2007-05-18 11:11 ` Andrey Panin
2007-05-22 9:08 ` Nitin Gupta
2007-05-22 19:44 ` Jan Engelhardt
2007-05-22 21:24 ` Bernd Petrovitsch
2007-05-23 16:35 ` Jeremy Fitzhardinge
2007-05-18 11:46 ` Richard Purdie
2007-05-22 9:19 ` Nitin Gupta
2007-05-18 20:04 ` Matt Mackall
2007-05-18 21:14 ` Krzysztof Halasa
2007-05-19 18:55 ` Bill Rugolsky Jr.
2007-05-19 21:52 ` Richard Purdie
2007-05-22 19:40 ` Jan Engelhardt
2007-05-19 18:12 devzero
2007-05-20 11:42 Tomasz Chmielewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4cefeab80705180427u54110396mfb3acd96c6c446bd@mail.gmail.com \
--to=nitingupta910@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@oberhumer.com \
--cc=richard@openedhand.com \
--cc=shdl@zakalwe.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®