Skip to content

Commit fdde6ab

Browse files
Sebastian Andrzej Siewiorpenberg
authored andcommitted
slab: use print_hex_dump
Less code and the advantage of ascii dump. before: | Slab corruption: names_cache start=c5788000, len=4096 | 000: 6b 6b 01 00 00 00 56 00 00 00 24 00 00 00 2a 00 | 010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff | 030: ff ff ff ff e2 b4 17 18 c7 e4 08 06 00 01 08 00 | 040: 06 04 00 01 e2 b4 17 18 c7 e4 0a 00 00 01 00 00 | 050: 00 00 00 00 0a 00 00 02 6b 6b 6b 6b 6b 6b 6b 6b after: | Slab corruption: size-4096 start=c38a9000, len=4096 | 000: 6b 6b 01 00 00 00 56 00 00 00 24 00 00 00 2a 00 kk....V...$...*. | 010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ | 020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ................ | 030: ff ff ff ff d2 56 5f aa db 9c 08 06 00 01 08 00 .....V_......... | 040: 06 04 00 01 d2 56 5f aa db 9c 0a 00 00 01 00 00 .....V_......... | 050: 00 00 00 00 0a 00 00 02 6b 6b 6b 6b 6b 6b 6b 6b ........kkkkkkkk Acked-by: Christoph Lameter <cl@linux.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Pekka Enberg <penberg@kernel.org>
1 parent 250f8e3 commit fdde6ab

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎mm/slab.c‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,15 +1811,15 @@ static void dump_line(char *data, int offset, int limit)
18111811
unsigned char error = 0;
18121812
int bad_count = 0;
18131813

1814-
printk(KERN_ERR "%03x:", offset);
1814+
printk(KERN_ERR "%03x: ", offset);
18151815
for (i = 0; i < limit; i++) {
18161816
if (data[offset + i] != POISON_FREE) {
18171817
error = data[offset + i];
18181818
bad_count++;
18191819
}
1820-
printk(" %02x", (unsigned char)data[offset + i]);
18211820
}
1822-
printk("\n");
1821+
print_hex_dump(KERN_CONT, "", 0, 16, 1,
1822+
&data[offset], limit, 1);
18231823

18241824
if (bad_count == 1) {
18251825
error ^= POISON_FREE;
@@ -2989,14 +2989,9 @@ static void check_slabp(struct kmem_cache *cachep, struct slab *slabp)
29892989
printk(KERN_ERR "slab: Internal list corruption detected in "
29902990
"cache '%s'(%d), slabp %p(%d). Hexdump:\n",
29912991
cachep->name, cachep->num, slabp, slabp->inuse);
2992-
for (i = 0;
2993-
i < sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t);
2994-
i++) {
2995-
if (i % 16 == 0)
2996-
printk("\n%03x:", i);
2997-
printk(" %02x", ((unsigned char *)slabp)[i]);
2998-
}
2999-
printk("\n");
2992+
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, slabp,
2993+
sizeof(*slabp) + cachep->num * sizeof(kmem_bufctl_t),
2994+
1);
30002995
BUG();
30012996
}
30022997
}

0 commit comments

Comments
 (0)