Dereference dma_addr_t?

I'm working with a network device driver and I would like to dump the source DMA memory to the kernel message file for inspection. I think this means I need to cast dma_addr_t to char*, then dereference the new char pointer. However, this crashed the kernel.

Here is what I did:

1
2
3
4
5
6
7
8
9
10
char data_in_memory[len];
dma_addr_t j;

for(j=0;j<len+1;j++){
        /* tx_bi->dma is of type dma_addr_t */
	data_in_memory[j] = *(char *)(tx_bi->dma+j);
}
data_in_memory[len]='\n';
	
printk("DMA Src Contents:  %s", data_in_memory); 

Any thoughts???

Any help is appreciated. Thanks!
Haven't you overrun data_in_memory?
Oops, I entered that into the post wrong.

1
2
3
4
5
6
7
8
9
10
char data_in_memory[len+1];
dma_addr_t j;

for(j=0;j<len+1;j++){
        /* tx_bi->dma is of type dma_addr_t */
	data_in_memory[j] = *(char *)(tx_bi->dma+j);
}
data_in_memory[len]='\n';
	
printk("DMA Src Contents:  %s", data_in_memory); 
Topic archived. No new replies allowed.