linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slub: fix check_bytes() for slub debugging
@ 2011-08-07  9:30 Akinobu Mita
  2011-08-08 21:24 ` Marcin Slusarz
  2011-08-09  3:10 ` Eric Dumazet
  0 siblings, 2 replies; 10+ messages in thread
From: Akinobu Mita @ 2011-08-07  9:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Akinobu Mita, Christoph Lameter, Pekka Enberg, Matt Mackall,
	linux-mm

The check_bytes() function is used by slub debugging.  It returns a pointer
to the first unmatching byte for a character in the given memory area.

If the character for matching byte is greater than 0x80, check_bytes()
doesn't work.  Becuase 64-bit pattern is generated as below.

	value64 = value | value << 8 | value << 16 | value << 24;
	value64 = value64 | value64 << 32;

The integer promotions are performed and sign-extended as the type of value
is u8.  The upper 32 bits of value64 is 0xffffffff in the first line, and
the second line has no effect.

This fixes the 64-bit pattern generation.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Matt Mackall <mpm@selenic.com>
Cc: linux-mm@kvack.org
---
 mm/slub.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index eb5a8f9..5695f92 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -701,7 +701,7 @@ static u8 *check_bytes(u8 *start, u8 value, unsigned int bytes)
 		return check_bytes8(start, value, bytes);
 
 	value64 = value | value << 8 | value << 16 | value << 24;
-	value64 = value64 | value64 << 32;
+	value64 = (value64 & 0xffffffff) | value64 << 32;
 	prefix = 8 - ((unsigned long)start) % 8;
 
 	if (prefix) {
-- 
1.7.4.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-08-09 21:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-07  9:30 [PATCH] slub: fix check_bytes() for slub debugging Akinobu Mita
2011-08-08 21:24 ` Marcin Slusarz
2011-08-09  1:08   ` Akinobu Mita
2011-08-09  3:10 ` Eric Dumazet
2011-08-09  3:33   ` Eric Dumazet
2011-08-09  9:38     ` Akinobu Mita
2011-08-09  9:43       ` Pekka Enberg
2011-08-09  9:54         ` Eric Dumazet
2011-08-09  9:46       ` Eric Dumazet
2011-08-09 21:46         ` Marcin Slusarz

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).