All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <bgerst@didntduck.org>
To: f.jimenez@bigfoot.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: array size limit in module?
Date: Thu, 10 Jan 2002 13:18:35 -0500	[thread overview]
Message-ID: <3C3DDAFB.E1DC0EFB@didntduck.org> (raw)
In-Reply-To: <20020110181054Z289122-13997+3040@vger.kernel.org>

Fernando Jimenez wrote:
> 
> Hi
> 
> I am trying to code a simple kernel module and I have found a problem I don't
> quite understand.
> 
> Here is the offending part of code:
> 
> char *sectors_array = NULL;
> ........
> secs_size=131072;
> sectors_array = kmalloc(secs_size*sizeof(char), GFP_KERNEL);
> for(i=0; i<secs_size; i++) {
>         sectors_array[i]=0;
> }
> 
> This bit of code, as it is, works fine. However, if I increment secs_size by
> one, ie, I do 'secs_size=131073;' instead of 131072, I get the following:

Use vmalloc for allocations that large, unless you must have the memory
physically contiguous.  128k is the largest amount of memory you can
allocate with kmalloc.

--

				Brian Gerst

  reply	other threads:[~2002-01-10 18:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10 18:13 array size limit in module? Fernando Jimenez
2002-01-10 18:18 ` Brian Gerst [this message]
2002-01-10 18:37   ` Benjamin LaHaise
2002-01-10 22:01 ` Alex Bligh - linux-kernel

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=3C3DDAFB.E1DC0EFB@didntduck.org \
    --to=bgerst@didntduck.org \
    --cc=f.jimenez@bigfoot.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.