Skip to content

Commit

Permalink
slub: fix check_bytes() for slub debugging
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Matt Mackall <[email protected]>
Reviewed-by: Marcin Slusarz <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
  • Loading branch information
mita authored and penberg committed Aug 9, 2011
1 parent 6fbabb2 commit ef62fb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ef62fb3

Please sign in to comment.