From: Andrew Morton Date: Fri, 9 Nov 2012 03:04:20 +0000 (+1100) Subject: dmapool-make-dmapool_debug-detect-corruption-of-free-marker-fix X-Git-Tag: next-20121112~5^2~189 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f4a1b5668a283ff0e2685b4d87899726d90ec4c5;p=karo-tx-linux.git dmapool-make-dmapool_debug-detect-corruption-of-free-marker-fix tidy code, fix comment, use sizeof(page->offset), use pr_err() Cc: Matthieu Castet Signed-off-by: Andrew Morton --- diff --git a/mm/dmapool.c b/mm/dmapool.c index e10898a08ca3..c67cdb88495c 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -350,23 +350,24 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, int i; u8 *data = retval; /* page->offset is stored in first 4 bytes */ - for (i = sizeof(int); i < pool->size; i++) { - if (data[i] != POOL_POISON_FREED) { - if (pool->dev) - dev_err(pool->dev, - "dma_pool_alloc %s, %p (corruped)\n", - pool->name, retval); - else - printk(KERN_ERR - "dma_pool_alloc %s, %p (corruped)\n", - pool->name, retval); - - /* we dump the first 4 bytes even if there are not - POOL_POISON_FREED */ - print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, - data, pool->size, 1); - break; - } + for (i = sizeof(page->offset); i < pool->size; i++) { + if (data[i] == POOL_POISON_FREED) + continue; + if (pool->dev) + dev_err(pool->dev, + "dma_pool_alloc %s, %p (corruped)\n", + pool->name, retval); + else + pr_err("dma_pool_alloc %s, %p (corruped)\n", + pool->name, retval); + + /* + * Dump the first 4 bytes even if they are not + * POOL_POISON_FREED + */ + print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, + data, pool->size, 1); + break; } } memset(retval, POOL_POISON_ALLOCATED, pool->size);