[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1382382343-12066-2-git-send-email-tomas.winkler@intel.com>
Date: Mon, 21 Oct 2013 22:05:36 +0300
From: Tomas Winkler <tomas.winkler@...el.com>
To: gregkh@...uxfoundation.org
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
Tomas Winkler <tomas.winkler@...el.com>
Subject: [char-misc-next 1/8] mei: debugfs: validate dev is not null
make static analyzer happy and
validate dev argument before dereferencing
Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
---
drivers/misc/mei/debugfs.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
index e3870f2..9162491 100644
--- a/drivers/misc/mei/debugfs.c
+++ b/drivers/misc/mei/debugfs.c
@@ -30,11 +30,15 @@ static ssize_t mei_dbgfs_read_meclients(struct file *fp, char __user *ubuf,
struct mei_device *dev = fp->private_data;
struct mei_me_client *cl;
const size_t bufsz = 1024;
- char *buf = kzalloc(bufsz, GFP_KERNEL);
+ char *buf;
int i;
int pos = 0;
int ret;
+ if (!dev)
+ return -ENODEV;
+
+ buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -80,10 +84,14 @@ static ssize_t mei_dbgfs_read_devstate(struct file *fp, char __user *ubuf,
{
struct mei_device *dev = fp->private_data;
const size_t bufsz = 1024;
- char *buf = kzalloc(bufsz, GFP_KERNEL);
+ char *buf;
int pos = 0;
int ret;
+ if (!dev)
+ return -ENODEV;
+
+ buf = kzalloc(bufsz, GFP_KERNEL);
if (!buf)
return -ENOMEM;
--
1.8.3.1
--
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