Re: [RFC][Update][Patch 12/16]Fix undefined ">> 32" in revoke code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mingming Cao wrote:
"val >> 32" is undefined if val is a 32-bit value, so this code is
broken if CONFIG_LBD is not set.  Make it safe for that case.

Signed-off-by: Stephen Tweedie <[email protected]>
Signed-off-by: Mingming Cao <[email protected]>


---

 linux-2.6.17-ming/fs/jbd/revoke.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/jbd/revoke.c~jbd-revoke-32bit-shift-fix fs/jbd/revoke.c
--- linux-2.6.17/fs/jbd/revoke.c~jbd-revoke-32bit-shift-fix	2006-06-28 16:47:09.695458913 -0700
+++ linux-2.6.17-ming/fs/jbd/revoke.c	2006-06-28 16:47:09.699458454 -0700
@@ -110,7 +110,7 @@ static inline int hash(journal_t *journa
 {
 	struct jbd_revoke_table_s *table = journal->j_revoke;
 	int hash_shift = table->hash_shift;
-	int hash = (int)block ^ (int)(block >> 32);
+	int hash = (int)block ^ (int)((block >> 31) >> 1);

It might be better to code it as:

	(int)((u64)block >> 32)

... which gcc can trivially recognize as 0 if block is 32 bits. Not sure if it can do that with the code above.

	-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux