diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2013-01-03 01:39:53 +0100 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-01-03 01:40:32 +0100 |
commit | 52441fa8f2f1ccc9fa97607c6ccf8b46b9fd15ae (patch) | |
tree | 5a5d4536de0898ed4ae4a012979e0ce17fdfb2ff | |
parent | virtio-blk: Don't free ida when disk is in use (diff) | |
download | linux-52441fa8f2f1ccc9fa97607c6ccf8b46b9fd15ae.tar.xz linux-52441fa8f2f1ccc9fa97607c6ccf8b46b9fd15ae.zip |
module: prevent warning when finit_module a 0 sized file
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.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index 250092c1d57d..41bc1189b061 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; |