From: Rusty Russell <rusty@rustcorp.com.au>
To: Sasha Levin <sasha.levin@oracle.com>, linux-kernel@vger.kernel.org
Cc: Sasha Levin <sasha.levin@oracle.com>
Subject: Re: [PATCH] module: prevent warning when finit_module a 0 sized file
Date: Thu, 03 Jan 2013 11:11:03 +1030 [thread overview]
Message-ID: <877gnv5c9s.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1356722837-1457-1-git-send-email-sasha.levin@oracle.com>
Sasha Levin <sasha.levin@oracle.com> writes:
> If we try to finit_module on a file sized 0 bytes vmalloc will
> scream and spit out a warning.
>
> Since modules have to be bigger than 0 bytes anyways we can just
> check that beforehand and avoid the warning.
Applied, but I added the comment you somehow missed :)
Thanks,
Rusty.
diff --git a/kernel/module.c b/kernel/module.c
index 250092c..41bc118 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2527,6 +2527,13 @@ static int copy_module_from_fd(int fd, struct load_info *info)
err = -EFBIG;
goto out;
}
+
+ /* Don't hand 0 to vmalloc, it whines. */
+ if (stat.size == 0) {
+ err = -EINVAL;
+ goto out;
+ }
+
info->hdr = vmalloc(stat.size);
if (!info->hdr) {
err = -ENOMEM;
next prev parent reply other threads:[~2013-01-03 1:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 19:27 [PATCH] module: prevent warning when finit_module a 0 sized file Sasha Levin
2013-01-03 0:41 ` Rusty Russell [this message]
2013-01-03 22:14 ` Sasha Levin
2013-01-07 0:50 ` Rusty Russell
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=877gnv5c9s.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.com \
/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.