public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard@openedhand.com>
To: Edward Shishkin <edward@namesys.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Nitin Gupta <nitingupta910@gmail.com>,
	reiserfs-devel <reiserfs-devel@vger.kernel.org>,
	Adrian Bunk <bunk@stusta.de>
Subject: [PATCH] lzo: Add some missing casts
Date: Sat, 28 Jul 2007 00:30:55 +0100	[thread overview]
Message-ID: <1185579055.6148.29.camel@localhost.localdomain> (raw)

Add some casts to the LZO compression algorithm after they were removed
during cleanup and shouldn't have been.

Signed-off-by: Richard Purdie <rpurdie@openedhand.com>

---

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?

Index: linux-2.6.22/lib/lzo/lzo1x_compress.c
===================================================================
--- linux-2.6.22.orig/lib/lzo/lzo1x_compress.c
+++ linux-2.6.22/lib/lzo/lzo1x_compress.c
@@ -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 char
 		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;



             reply	other threads:[~2007-07-27 23:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27 23:30 Richard Purdie [this message]
2007-07-28 19:30 ` [PATCH] reiser4: use lzo library functions Edward Shishkin

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=1185579055.6148.29.camel@localhost.localdomain \
    --to=richard@openedhand.com \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@stusta.de \
    --cc=edward@namesys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nitingupta910@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    /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