summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-04 11:59:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-08 13:09:41 -0700
commit9ee81443b99ae3a022ba145ed62e22a5173e33f6 (patch)
treea276e6067a34ed1939347c1b2e935806fe6e2051 /drivers
parentd35ebe80259e889548aa9714e0365aa12fcba7a2 (diff)
staging: wilc1000: prevent some overflows in debugfs
Add some limits here so we don't corrupt memory. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/wilc1000/wilc_debugfs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/staging/wilc1000/wilc_debugfs.c b/drivers/staging/wilc1000/wilc_debugfs.c
index 74b9fd5ba27b..c328208cda29 100644
--- a/drivers/staging/wilc1000/wilc_debugfs.c
+++ b/drivers/staging/wilc1000/wilc_debugfs.c
@@ -53,6 +53,9 @@ static ssize_t wilc_debug_level_write(struct file *filp, const char *buf, size_t
char buffer[128] = {};
int flag = 0;
+ if (count > sizeof(buffer))
+ return -EINVAL;
+
if (copy_from_user(buffer, buf, count)) {
return -EFAULT;
}
@@ -99,6 +102,9 @@ static ssize_t wilc_debug_region_write(struct file *filp, const char *buf, size_
char buffer[128] = {};
int flag;
+ if (count > sizeof(buffer))
+ return -EINVAL;
+
if (copy_from_user(buffer, buf, count)) {
return -EFAULT;
}