[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1356722837-1457-1-git-send-email-sasha.levin@oracle.com>
Date: Fri, 28 Dec 2012 14:27:17 -0500
From: Sasha Levin <sasha.levin@...cle.com>
To: Rusty Russell <rusty@...tcorp.com.au>, linux-kernel@...r.kernel.org
Cc: Sasha Levin <sasha.levin@...cle.com>
Subject: [PATCH] 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@...cle.com>
---
kernel/module.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/module.c b/kernel/module.c
index 250092c..2e1ce2e 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2527,6 +2527,12 @@ static int copy_module_from_fd(int fd, struct load_info *info)
err = -EFBIG;
goto out;
}
+
+ if (stat.size == 0) {
+ err = -EINVAL;
+ goto out;
+ }
+
info->hdr = vmalloc(stat.size);
if (!info->hdr) {
err = -ENOMEM;
--
1.8.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists