kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: kernel BUG while reading from SPI into static buffer
Date: Fri, 13 May 2011 21:32:23 +0700	[thread overview]
Message-ID: <BANLkTinS9Xy3O6GB5Lt4xoEf44ncYCQBHw@mail.gmail.com> (raw)
In-Reply-To: <BANLkTin25_+YjJLbFWHeDhjG48gKwR65dg@mail.gmail.com>

Hi....

On Fri, May 13, 2011 at 14:03, Felix Varghese <felixv1986@gmail.com> 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

  reply	other threads:[~2011-05-13 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13  7:03 kernel BUG while reading from SPI into static buffer Felix Varghese
2011-05-13 14:32 ` Mulyadi Santosa [this message]
2011-05-13 14:33   ` Mulyadi Santosa
2011-05-13 15:08 ` Greg KH
2011-05-16  5:55   ` Felix Varghese
2011-05-16 14:17     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinS9Xy3O6GB5Lt4xoEf44ncYCQBHw@mail.gmail.com \
    --to=mulyadi.santosa@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).