[media] staging: lirc: freeing ERR_PTRs
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 Sep 2014 11:10:05 +0000 (08:10 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 23 Sep 2014 19:13:36 +0000 (16:13 -0300)
We call kfree(data_buf) in the error handling and that will oops if this
is an error pointer.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/staging/media/lirc/lirc_imon.c
drivers/staging/media/lirc/lirc_sasem.c

index 96c76b33770bb546f249eac34990b222bdf8d40d..5441f40cf5a1b7246ead3e2af7f1aef693a0fabd 100644 (file)
@@ -414,6 +414,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
        data_buf = memdup_user(buf, n_bytes);
        if (IS_ERR(data_buf)) {
                retval = PTR_ERR(data_buf);
+               data_buf = NULL;
                goto exit;
        }
 
index 81f90e17e1e67f792e4e5d5da6875e4c2d7e7714..c32e2965da875ad9fa3e4b88dd8054892359d12e 100644 (file)
@@ -392,6 +392,7 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
        data_buf = memdup_user((void const __user *)buf, n_bytes);
        if (IS_ERR(data_buf)) {
                retval = PTR_ERR(data_buf);
+               data_buf = NULL;
                goto exit;
        }