public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lzo: fix possible typo in decompresor
@ 2008-04-10 20:38 Harvey Harrison
  2008-04-10 20:49 ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Harvey Harrison @ 2008-04-10 20:38 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Andrew Morton, Linus Torvalds, LKML

Shift of a le value seems strange, probably meant to shift the cpu-order
variable as in the prvious section of the switch statement.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 lib/lzo/lzo1x_decompress.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
index 9dc7056..77f0f9b 100644
--- a/lib/lzo/lzo1x_decompress.c
+++ b/lib/lzo/lzo1x_decompress.c
@@ -158,7 +158,7 @@ match:
 					t += 7 + *ip++;
 				}
 				m_pos -= le16_to_cpu(get_unaligned(
-					(const unsigned short *)ip) >> 2);
+					(const unsigned short *)ip)) >> 2;
 				ip += 2;
 				if (m_pos == op)
 					goto eof_found;
-- 
1.5.5.144.g3e42




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

* Re: [PATCH] lzo: fix possible typo in decompresor
  2008-04-10 20:38 [PATCH] lzo: fix possible typo in decompresor Harvey Harrison
@ 2008-04-10 20:49 ` Linus Torvalds
  2008-04-10 20:52   ` Harvey Harrison
  2008-04-10 22:18   ` Richard Purdie
  0 siblings, 2 replies; 5+ messages in thread
From: Linus Torvalds @ 2008-04-10 20:49 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Richard Purdie, Andrew Morton, LKML



On Thu, 10 Apr 2008, Harvey Harrison wrote:
>
> Shift of a le value seems strange, probably meant to shift the cpu-order
> variable as in the prvious section of the switch statement.

Hmm. This patch looks ObviouslyCorrect(tm), but it worries me that 
apparently the old broken code has been around since last July, and afaik 
it can never have worked on big-endian machines.

So did nobody ever use it, or why hasn't this ever triggered? How did you 
find this? A sparse warning?

		Linus

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

* Re: [PATCH] lzo: fix possible typo in decompresor
  2008-04-10 20:49 ` Linus Torvalds
@ 2008-04-10 20:52   ` Harvey Harrison
  2008-04-10 22:18   ` Richard Purdie
  1 sibling, 0 replies; 5+ messages in thread
From: Harvey Harrison @ 2008-04-10 20:52 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Richard Purdie, Andrew Morton, LKML

On Thu, 2008-04-10 at 13:49 -0700, Linus Torvalds wrote:
> 
> On Thu, 10 Apr 2008, Harvey Harrison wrote:
> >
> > Shift of a le value seems strange, probably meant to shift the cpu-order
> > variable as in the prvious section of the switch statement.
> 
> Hmm. This patch looks ObviouslyCorrect(tm), but it worries me that 
> apparently the old broken code has been around since last July, and afaik 
> it can never have worked on big-endian machines.
> 
> So did nobody ever use it, or why hasn't this ever triggered? How did you 
> find this? A sparse warning?
> 
> 		Linus

When converting in tree users to my proposed unaligned byteswapping api.
See the 8 patch series posted today to linux-arch.

Harvey


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

* Re: [PATCH] lzo: fix possible typo in decompresor
  2008-04-10 20:49 ` Linus Torvalds
  2008-04-10 20:52   ` Harvey Harrison
@ 2008-04-10 22:18   ` Richard Purdie
  2008-04-10 22:22     ` Harvey Harrison
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2008-04-10 22:18 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Harvey Harrison, Andrew Morton, LKML

On Thu, 2008-04-10 at 13:49 -0700, Linus Torvalds wrote:
> On Thu, 10 Apr 2008, Harvey Harrison wrote:
> >
> > Shift of a le value seems strange, probably meant to shift the cpu-order
> > variable as in the prvious section of the switch statement.
> 
> Hmm. This patch looks ObviouslyCorrect(tm), but it worries me that 
> apparently the old broken code has been around since last July, and afaik 
> it can never have worked on big-endian machines.
> 
> So did nobody ever use it, or why hasn't this ever triggered? How did you 
> find this? A sparse warning?

The heaviest users of the lzo code I know of are little-endian ARM
devices through jffs2. When the code was merged there was a lot of
discussion about the best way to handle the endian issues and unaligned
accesses and whilst I seem to remember someone posting big-endian test
results it could have been before some of the later changes were made.

So yes its possible its not been run on BE until now or that isn't a
common code path. I've checked this against the external LZO library its
based on and the patch is correct

Acked-by: Richard Purdie <rpurdie@rpsys.net>

-- 
Richard



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

* Re: [PATCH] lzo: fix possible typo in decompresor
  2008-04-10 22:18   ` Richard Purdie
@ 2008-04-10 22:22     ` Harvey Harrison
  0 siblings, 0 replies; 5+ messages in thread
From: Harvey Harrison @ 2008-04-10 22:22 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Linus Torvalds, Andrew Morton, LKML

On Thu, 2008-04-10 at 23:18 +0100, Richard Purdie wrote:
> On Thu, 2008-04-10 at 13:49 -0700, Linus Torvalds wrote:
> > On Thu, 10 Apr 2008, Harvey Harrison wrote:
> > >
> > > Shift of a le value seems strange, probably meant to shift the cpu-order
> > > variable as in the prvious section of the switch statement.
> > 
> > Hmm. This patch looks ObviouslyCorrect(tm), but it worries me that 
> > apparently the old broken code has been around since last July, and afaik 
> > it can never have worked on big-endian machines.
> > 
> > So did nobody ever use it, or why hasn't this ever triggered? How did you 
> > find this? A sparse warning?
> 
> The heaviest users of the lzo code I know of are little-endian ARM
> devices through jffs2. When the code was merged there was a lot of
> discussion about the best way to handle the endian issues and unaligned
> accesses and whilst I seem to remember someone posting big-endian test
> results it could have been before some of the later changes were made.
> 
> So yes its possible its not been run on BE until now or that isn't a
> common code path. I've checked this against the external LZO library its
> based on and the patch is correct
> 
> Acked-by: Richard Purdie <rpurdie@rpsys.net>
> 

This is one of the reasons I thought about for adding the new api, the
bracketing is just too easy to get wrong when you throw
get/put_unaligned into the mix.

Harvey


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

end of thread, other threads:[~2008-04-10 22:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-10 20:38 [PATCH] lzo: fix possible typo in decompresor Harvey Harrison
2008-04-10 20:49 ` Linus Torvalds
2008-04-10 20:52   ` Harvey Harrison
2008-04-10 22:18   ` Richard Purdie
2008-04-10 22:22     ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox