Re: single bit flip detector.

From: Alexey Dobriyan
Date: Tue Aug 01 2006 - 18:59:31 EST


On Tue, Aug 01, 2006 at 06:36:22PM -0400, Dave Jones wrote:
> 000: 6b 6b 6b 6b 6a 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b

> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -1638,10 +1638,29 @@ static void poison_obj(struct kmem_cache
> static void dump_line(char *data, int offset, int limit)
> {
> int i;
> + unsigned char total=0, bad_count=0;

" = 0"

> printk(KERN_ERR "%03x:", offset);
> - for (i = 0; i < limit; i++)
> + for (i = 0; i < limit; i++) {
> + if (data[offset+i] != POISON_FREE) {

" + i"

> + total += data[offset+i];

ditto

> + ++bad_count;

How about post increment?

> + }
> printk(" %02x", (unsigned char)data[offset + i]);
> + }
> printk("\n");
> +
> + if (bad_count == 1) {
> + errors = total ^ POISON_FREE;

undeclared "errors"

> + if ((errors && !(errors & (errors-1))) {

^^^

Turn on CONFIG_DEBUG_SLAB before compiling. ;-)

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