From: "Huo Zhigang" <zghuo@gatekeeper.ncic.ac.cn>
To: lkml <linux-kernel@vger.kernel.org>
Subject: Re: Re: what`s wrong?
Date: Thu, 25 Apr 2002 17:12:21 +0800 [thread overview]
Message-ID: <7754BE8DC82.AAA4CC2@gatekeeper.ncic.ac.cn> (raw)
>On Apr 24, 2002 18:06 +0200, il boba wrote:
>> Is there anybody that can help me understand what`s wrong with this code?
>Yes, easily spotted a major problem without even reading the whole
>thing.
>> #define BUFSIZ 8192
>>
>> int init_module()
>> {
>> int err_frame[BUFSIZ];
>
>The entire kernel stack is only 8kB in size. You have already killed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>a bunch of random memory by allocating this much memory on the stack.
>You allocated 4*8192 = 32kB on the stack here.
Sure, the kernel stack is 8192 Bytes, but "err_frame[]" is a local variable. Does the kernel allocate memory for "err_frame[]" from the stack??
>> int init_err_frame(int err_frame[]) {
>> int i, k = 0, j = 0;
>> char buffer[BUFSIZ];
>
>Another 8kB on the stack here - further random corruption.
Here, I think, err_frame[] as a function parameter will take 8K in the kernel stack.
Am I correct?
Thank you.
next reply other threads:[~2002-04-25 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-25 9:12 Huo Zhigang [this message]
2002-04-25 9:50 ` Matti Aarnio
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=7754BE8DC82.AAA4CC2@gatekeeper.ncic.ac.cn \
--to=zghuo@gatekeeper.ncic.ac.cn \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®