From: Michael Tokarev <mjt@tls.msk.ru>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Jiri Kosina <jikos@jikos.cz>, Tomas M <tomas@slax.org>,
linux-kernel@vger.kernel.org
Subject: Re: [patch] [bugfix] loop.c
Date: Fri, 23 Mar 2007 22:50:58 +0300 [thread overview]
Message-ID: <46042FA2.20303@tls.msk.ru> (raw)
In-Reply-To: <20070323155115.89f86b3b.dada1@cosmosbay.com>
Eric Dumazet wrote:
[]
>
> MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-16384)");
Speaking of which, I wonder... Here, and in many other places.
If some variable is marked as MODULE_PARAM (or whatever it is called
nowadays), used in module init routine, AND subsequently used for various
bound checks and loops...
Consider this:
MODULE_PARAM(n);
foo_init() {
mem = kmalloc(n * sizeof(void*));
..
}
foo_func() {
for (i = 0; i < n; ++i)
do_something_with_mem(mem[i])
}
and so on. Together with:
# modprobe foo n=10
# echo 20 > /sys/module/foo/parameters/n
After that, we have 10 entries in mem[], and
n is equal to 20, so the for-loop above will be
up to i=19. Which will reference unallocated
memory....
Amd I dreaming?
Thanks.
/mjt
next prev parent reply other threads:[~2007-03-23 19:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-23 14:04 [patch] [bugfix] loop.c Tomas M
2007-03-23 14:18 ` Jiri Kosina
2007-03-23 14:19 ` Eric Dumazet
2007-03-23 14:25 ` Jiri Kosina
2007-03-23 14:51 ` Eric Dumazet
2007-03-23 19:50 ` Michael Tokarev [this message]
2007-03-23 23:18 ` Jiri Kosina
2007-03-23 14:33 ` William Lee Irwin III
2007-03-23 14:36 ` Al Viro
2007-03-23 14:48 ` Eric Dumazet
2007-03-23 14:56 ` Al Viro
2007-03-23 14:41 ` Christoph Hellwig
2007-03-23 14:49 ` Al Viro
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=46042FA2.20303@tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=dada1@cosmosbay.com \
--cc=jikos@jikos.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=tomas@slax.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.