Re: kernel BUG while reading from SPI into static buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi....

On Fri, May 13, 2011 at 14:03, Felix Varghese <felixv1986@xxxxxxxxx> wrote:
> Hi,
>
> I am trying to read some data via SPI on an a modified (custom SPI device
> attached) AT91SAM9G20-EK board. If I pass a local array buffer, declared as
> "char buffer[100];" as the rx_buf pointer for the spi transfer, the code
> works fine. But if I just change the declaration to "static char
> buffer[100]" instead, I get the following crash:
>
> kernel BUG at arch/arm/mm/dma-mapping.c:425!
> Unable to handle kernel NULL pointer dereference at virtual address 00000000


Hmm, I think this is the corresponding line:
BUG_ON(!virt_addr_valid(kaddr) || !virt_addr_valid(kaddr + size - 1)    );

alright...so it roughly says that the address (buffer) falls into
invalid virt address. And, virt_addr_valid is:
static inline int virt_addr_valid(const volatile void *kaddr)
{
        extern void *high_memory;  /* copied from <linux/mm.h> */
       return ((unsigned long)kaddr >= PAGE_OFFSET && kaddr < high_memory);
}

OK, a bit clear now.... so, I can say base on the above code snippet,
buffer...when declared as static, somehow falls into non
ZONE_NORMAL......i.e non directly mapped memory area...

Feel free to try to observer whether this statement is correct or
not... and you should check the address of "buffer" when declared as
static I guess....

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux