lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 10 Nov 2016 15:22:38 +0530
From:   Shailendra Verma <shailendra.v@...sung.com>
To:     Jarod Wilson <jarod@...sonet.com>,
        Mauro Carvalho Chehab <mchehab@....samsung.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-media@...r.kernel.org, devel@...verdev.osuosl.org,
        Shailendra Verma <shailendra.v@...sung.com>,
        Shailendra Verma <shailendra.capricorn@...il.com>
Cc:     linux-kernel@...r.kernel.org, vidushi.koul@...sung.com
Subject: [PATCH 2/2] Staging: Media: Lirc - Improvement in code readability

From: "Shailendra Verma" <shailendra.v@...sung.com>

There is no need to call kfree() if memdup_user() fails, as no memory
was allocated and the error in the error-valued pointer should be returned.

Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
 drivers/staging/media/lirc/lirc_imon.c  |    5 ++---
 drivers/staging/media/lirc/lirc_sasem.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c b/drivers/staging/media/lirc/lirc_imon.c
index 198a805..610d38c 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -408,9 +408,8 @@ 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;
+		mutex_unlock(&context->ctx_lock);
+		return PTR_ERR(data_buf);
 	}
 
 	memcpy(context->tx.data_buf, data_buf, n_bytes);
diff --git a/drivers/staging/media/lirc/lirc_sasem.c b/drivers/staging/media/lirc/lirc_sasem.c
index 4678ae1..4fd810b 100644
--- a/drivers/staging/media/lirc/lirc_sasem.c
+++ b/drivers/staging/media/lirc/lirc_sasem.c
@@ -384,9 +384,8 @@ 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;
+		mutex_unlock(&context->ctx_lock);
+		return PTR_ERR(data_buf);
 	}
 
 	memcpy(context->tx.data_buf, data_buf, n_bytes);
-- 
1.7.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ